From 5c8f6334a517472854e0b3580541d2fd5fee8dc4 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Mon, 25 Oct 2021 13:22:44 -0300 Subject: [PATCH] Specs sheet: fixed headings row didn't compute width/height --- kibot/bom/xlsx_writer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/kibot/bom/xlsx_writer.py b/kibot/bom/xlsx_writer.py index 9b78657e..e29714ff 100644 --- a/kibot/bom/xlsx_writer.py +++ b/kibot/bom/xlsx_writer.py @@ -253,10 +253,18 @@ def create_meta(workbook, name, columns, parts, fmt_head, fmt_cols, max_w): worksheet = workbook.add_worksheet(name) to_col = {} col_w = [] + row_h = 1 for c, col in enumerate(columns): worksheet.write_string(0, c, col, fmt_head) to_col[col] = c - col_w.append(max(len(col), 6)) + text_l = max(len(col), 6) + if text_l > max_w: + h = len(wrap(text, max_w)) + row_h = max(row_h, h) + text_l = max_w + col_w.append(text_l) + if row_h > 1: + worksheet.set_row(0, 15.0*row_h) for r, part in enumerate(parts): # Add the references as another spec part.specs[ColumnList.COL_REFERENCE] = (ColumnList.COL_REFERENCE, part.collapsed_refs)