Skip to content

Fix MergeCells returning null for XLS files without merged cells#747

Merged
appel1 merged 1 commit into
developfrom
fix/null-merge-cells
May 27, 2026
Merged

Fix MergeCells returning null for XLS files without merged cells#747
appel1 merged 1 commit into
developfrom
fix/null-merge-cells

Conversation

@appel1

@appel1 appel1 commented May 27, 2026

Copy link
Copy Markdown
Collaborator

XlsWorksheet only assigned MergeCells when the file contained merge cells, leaving it null for files with none. CsvWorksheet also returned null. XLSX and XLSB always return an empty array, so this was an inconsistency.

Since null carries no extra meaning over an empty array, make all implementations consistent: always return an empty array.

Calling AsDataSet with FillMergedCellsValue = true on files without merged cells (including all CSV files) previously threw ArgumentNullException. This fixes the crash.

XlsWorksheet only assigned MergeCells when the file contained merge
cells, leaving it null for files with none. CsvWorksheet also returned
null. XLSX and XLSB always return an empty array, so this was an
inconsistency.

Since null carries no extra meaning over an empty array, make all
implementations consistent: always return an empty array.

Calling AsDataSet with FillMergedCellsValue = true on files without
merged cells (including all CSV files) previously threw
ArgumentNullException. This fixes the crash.
@appel1 appel1 force-pushed the fix/null-merge-cells branch from 11890da to d284942 Compare May 27, 2026 10:09
@appel1 appel1 merged commit e920585 into develop May 27, 2026
2 checks passed
@appel1 appel1 deleted the fix/null-merge-cells branch May 27, 2026 10:16
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