Skip to content

Fix Excel conversion on cell-less (hidden) rows#130

Merged
SimonCropp merged 3 commits into
mainfrom
Fix-Excel-conversion-on-cell-less-(hidden)-rows
Jul 1, 2026
Merged

Fix Excel conversion on cell-less (hidden) rows#130
SimonCropp merged 3 commits into
mainfrom
Fix-Excel-conversion-on-cell-less-(hidden)-rows

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

A hidden row is emitted as an empty with no cells. Two code paths mishandled it when it was the first row in a sheet:

  • The CSV builder ran builder.Length -= 1 to trim a trailing comma that was never appended, throwing ArgumentOutOfRangeException ("value ('-1') must be a non-negative value").
  • GetColumnInfos picked the empty row as the header and surfaced no columns (also skewing the rich-text/note lookups keyed to the header row index).

Both now skip rows with no cells. Adds the HiddenRow sample/test ported from Verify.ClosedXml, plus a GetColumnInfos unit test for the header fix.

A hidden row is emitted as an empty <row/> with no cells. Two code paths
mishandled it when it was the first row in a sheet:

- The CSV builder ran `builder.Length -= 1` to trim a trailing comma that
  was never appended, throwing ArgumentOutOfRangeException ("value ('-1')
  must be a non-negative value").
- GetColumnInfos picked the empty row as the header and surfaced no
  columns (also skewing the rich-text/note lookups keyed to the header
  row index).

Both now skip rows with no cells. Adds the HiddenRow sample/test ported
from Verify.ClosedXml, plus a GetColumnInfos unit test for the header fix.
@SimonCropp SimonCropp added this to the 1.19.0 milestone Jun 30, 2026
@SimonCropp SimonCropp merged commit f6eac10 into main Jul 1, 2026
4 checks passed
@SimonCropp SimonCropp deleted the Fix-Excel-conversion-on-cell-less-(hidden)-rows branch July 1, 2026 00:40
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.

1 participant