Row insertion/deletion does not update worksheet <dimension>, causing readers to miss appended rows
Description
After inserting or deleting rows with OfficeCLI, the worksheet <dimension ref="..."> is not updated:
- After insertion, the declared range can be too small.
- After deletion, the declared range can remain too large.
Reproduced with 1.0.145 and 1.0.149, so this is not a regression introduced only in 1.0.149.
Steps to reproduce
- Use a worksheet whose last row is N.
- Append a row and close the file:
officecli add <file> /<sheet> --type row --index <N+1>
officecli close <file>- Unzip the resulting
.xlsxand inspect the correspondingxl/worksheets/sheet*.xml. - Compare the last row declared by
<dimension ref="...">with the maximumrattribute of the<row>elements in<sheetData>.
Deleting the last row also leaves the dimension unchanged, with an oversized declared range.
Actual result
The dimension retains the old range after row insertion/deletion. In one observed insertion case:
- Declared dimension:
A1:XFD227 - Actual sheet data: 228
<row>elements, including row 228 - The dimension was not expanded to include the appended row.
Expected result
After inserting or deleting rows and saving, the worksheet dimension, if present, should be updated to reflect the actual used range.
Impact
Readers that rely on the declared dimension to determine iteration bounds can silently omit appended rows. We encountered this with openpyxl in read_only mode and an internal diff tool; other dimension-dependent Java/JS readers may be affected as well.
In our workflow, an agent appended and saved a row, but another person could not see it through these readers. This initially looked like the agent had failed to save its changes, even though the new row was present in the worksheet XML.
Existing diagnostics do not detect this
validatereportsValidation passed; the dimension mismatch is not flagged as a schema error.view issuesonly reports text overflow, without identifying this mismatch.
Please synchronize the dimension during row mutations and add save-and-reread regression tests for appending and deleting the last row.
Source: iOfficeAI/OfficeCLI