BIM: fix Arch_Schedule column width handling

Fixes #20723.

The clearAll method resets the column widths of the sheet. The code now stores the old widths and restores them after calling the method.

The old problem that the method would remove the custom property no longer occurs so that code was removed.
This commit is contained in:
Roy-043
2025-04-10 10:21:34 +02:00
committed by Chris Hennes
parent 7b46ac4cd6
commit a0796f6625

View File

@@ -203,14 +203,16 @@ class _ArchSchedule:
if not (obj.CreateSpreadsheet or force):
return
sp = self.getSpreadSheet(obj, force=True)
widths = [sp.getColumnWidth(col) for col in ("A", "B", "C")]
sp.clearAll()
# clearAll removes the custom property, we need to re-add it:
self.setSchedulePropertySpreadsheet(sp, obj)
# clearAll resets the column widths:
for col, width in zip(("A", "B", "C"), widths):
sp.setColumnWidth(col, width)
# set headers
sp.set("A1","Operation")
sp.set("B1","Value")
sp.set("C1","Unit")
sp.setStyle('A1:C1', 'bold', 'add')
sp.set("A1", "Operation")
sp.set("B1", "Value")
sp.set("C1", "Unit")
sp.setStyle("A1:C1", "bold", "add")
# write contents
for k,v in self.data.items():
sp.set(k,v)