mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +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
|
# 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
|
num_rows_table = len(first_table.getElementsByType(TableRow)) - 1 # Exclude header row
|
||||||
if len(df) < num_rows_table:
|
if len(df) < num_rows_table:
|
||||||
for i in range(len(df) + 1, num_rows_table + 1): # +1 to account for header
|
rows = first_table.getElementsByType(TableRow)
|
||||||
for cell in first_table.getElementsByType(TableRow)[i].getElementsByType(TableCell):
|
for i in reversed(range(len(df) + 1, num_rows_table + 1)): # +1 to account for header
|
||||||
for item in cell.childNodes:
|
first_table.removeChild(rows[i])
|
||||||
cell.removeChild(item)
|
|
||||||
|
|
||||||
ods_document.save(output)
|
ods_document.save(output)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user