Skip to content

Fix worksheet dimensions when XML metadata is incomplete - #470

Open
lite-tx wants to merge 2 commits into
QtExcel:masterfrom
lite-tx:codex/issue-440-worksheet-dimension
Open

Fix worksheet dimensions when XML metadata is incomplete#470
lite-tx wants to merge 2 commits into
QtExcel:masterfrom
lite-tx:codex/issue-440-worksheet-dimension

Conversation

@lite-tx

@lite-tx lite-tx commented Jul 24, 2026

Copy link
Copy Markdown

Summary

  • update the current row and column when an explicit cell reference is read
  • expand the worksheet dimension from every valid loaded cell
  • preserve any larger dimension already declared by the worksheet XML

The <dimension> element can be missing or incomplete. Previously, explicit cell references did not update col_num, and a syntactically valid but incomplete dimension prevented the later fallback from recalculating the range. This made cells readable while Worksheet::dimension() still reported an incorrect last column. Tracking explicit references also ensures a following cell without an r attribute is placed in the next column.

Verification

  • reproduced incorrect ranges for missing, narrow, and shifted <dimension> elements on current master
  • reproduced misplaced cells when explicit and implicit cell references are mixed
  • verified the fix with a normal workbook plus five valid ZIP fixtures:
    • missing dimension
    • narrow dimension
    • shifted starting cell
    • mixed explicit/implicit cell and row references
    • an oversized dimension that must not be shrunk
  • verified all expected cell values and final dimensions after loading
  • built and ran the regression with Qt 5.15.2/MSVC in Debug, Release static, and Release shared configurations
  • built and ran the regression with Qt 6.6.0/MSVC in Release static configuration
  • built and ran TestExcel through qmake/nmake

Fixes #440

@sonarqubecloud

Copy link
Copy Markdown

@lite-tx
lite-tx marked this pull request as ready for review July 24, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trouble reading .xlsx without fulldata in "dimension" in sheet

1 participant