Skip to content

Read the cells of a row that omits its index - #10

Merged
almasumdev merged 1 commit into
almasumdev:mainfrom
cdeil:row-index
Oct 16, 2026
Merged

almasumdev merged 1 commit into
almasumdev:mainfrom
cdeil:row-index

Conversation

@cdeil

@cdeil cdeil commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Problem. <row> without r is valid (the attribute is optional in
ECMA-376 18.3.1.73) and means the row after the previous one. The SAX reader
left the row index at −1 and dropped every cell in such a row, even one placed
by its own r="A1"; an unindexed row after an indexed one reused the previous
row's index, so positional cells overwrote it. openpyxl reads
<row><c r="A1"><v>42</v></c></row> as A1 = 42; the library returned null and
dropped the value on save. Inherited from the original package.

A second effect of the same loop: ht, hidden, outlineLevel and
collapsed were applied as they were met, so a writer that puts them before
r attached them to the previous row.

Fix. The row index is inferred when r is absent, a cell carrying its own
reference is always placed by it, and the row's attributes are applied once
the index is known.

Validation. test/reader_test.dart, "Rows Without Explicit Indices":
omitted r with an explicit cell, an unindexed row after r="3" (A3, A4,
B4, matching openpyxl's reading of the same file), rows with no index at all,
and attributes written before r. All fail before, pass after; suite and
analyzer clean.

🤖 Generated with Claude Code

A <row> without r is valid (the attribute is optional in ECMA-376
18.3.1.73) and means the row after the previous one, yet the SAX reader
left the row index at -1 and dropped every cell in it, even one placed
by its own r="A1". An unindexed row after an indexed one reused the
previous row's index, so positional cells overwrote it. The index is now
inferred when absent, a cell with its own reference is always placed,
and the row's ht/hidden/outline attributes are applied after the index
is known rather than in attribute order.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@almasumdev
almasumdev merged commit fce8de9 into almasumdev:main Oct 16, 2026
8 checks passed
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.

2 participants