iOfficeAI / iOfficeAI/OfficeCLI
Row insertion/deletion does not update worksheet <dimension>, causing readers to miss appended rows
- Dominant language
- C#
- Stars
- 30.7k
- Forks
- 2.1k
- Avg merge
- 9d 8h
- Merged PRs (30d)
- 5
Description
### Description
After inserting or deleting rows with OfficeCLI, the worksheet `` 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
1. Use a worksheet whose last row is N.
2. Append a row and close the file:
```text
officecli add / --type row --index
officecli close
```
3. Unzip the resulting `.xlsx` and inspect the corresponding `xl/worksheets/sheet*.xml`.
4. Compare the last row declared by `` with the maximum `r` attribute of the `` elements in ``.
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 `` 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
- `validate` reports `Validation passed`; the dimension mismatch is not flagged as a schema error.
- `view issues` only 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.
Contributor guide
Research direction
Start by reproducing the issue with the documented officecli add and close commands, then inspect xl/worksheets/sheet*.xml and compare dimension ref with the row r attributes. Trace the row-mutation and save paths; done means append and delete operations synchronize the dimension, with save-and-reread regression tests covering both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100