mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
See #5940. Fix bug where using preserve existing in IfcCSV didn't fully purge extra rows, possibly leading to orphaned data (which LibreOffice will render as 0 if it is a number value type)
This commit is contained in:
@@ -324,10 +324,9 @@ class IfcCsv:
|
||||
# If the DataFrame has fewer rows than the table, blank out the extra rows
|
||||
num_rows_table = len(first_table.getElementsByType(TableRow)) - 1 # Exclude header row
|
||||
if len(df) < num_rows_table:
|
||||
for i in range(len(df) + 1, num_rows_table + 1): # +1 to account for header
|
||||
for cell in first_table.getElementsByType(TableRow)[i].getElementsByType(TableCell):
|
||||
for item in cell.childNodes:
|
||||
cell.removeChild(item)
|
||||
rows = first_table.getElementsByType(TableRow)
|
||||
for i in reversed(range(len(df) + 1, num_rows_table + 1)): # +1 to account for header
|
||||
first_table.removeChild(rows[i])
|
||||
|
||||
ods_document.save(output)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user