Minor fix

This commit is contained in:
Dion Moult
2024-01-13 00:00:58 +11:00
parent 54bf41816b
commit c60ad6b8a0
@@ -74,7 +74,6 @@ class Scheduler:
column_dimensions = {k: v.width for k, v in sheet.column_dimensions.items()}
row_dimensions = {k: v.height for k, v in sheet.row_dimensions.items()}
print(row_dimensions)
default_width = 8.43 # 8.43 characters wide
default_height = 15 # 15pt seems to be the default height
@@ -83,7 +82,13 @@ class Scheduler:
pass
y = self.margin
for row in sheet.iter_rows():
rows = list(sheet.iter_rows())
total_rows = len(rows)
for i, row in enumerate(rows):
# The last row may contain only null values
if i == (total_rows - 1) and not [c for c in row if c.value is not None]:
continue
x = self.margin
for cell in row:
if isinstance(cell, openpyxl.cell.cell.MergedCell):
@@ -135,6 +140,10 @@ class Scheduler:
)
)
if not cell.value:
x += unmerged_width
continue
font_size = cell.font.size or 11 # 11pt default
font_size = font_size / FONT_SIZE_PT * FONT_SIZE # Magic?