Skip to content

fix(xlsx): Fixes the datatype for numerical cells - #217

Merged
oyessb merged 5 commits into
mainfrom
fix/values
Nov 3, 2026
Merged

oyessb merged 5 commits into
mainfrom
fix/values

Conversation

@likp

@likp likp commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

All data cells are formatted as string in the Excel output. This PR changes this so that data cells are formatted as numerical if the data value is numerical.

likp added 2 commits October 26, 2026 13:54
Made sure that the cells are numerical data if they are numbers
@likp

likp commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

@oyessb Could you test this out and see if it solves the problem?
Is there a issue anywhere for this?


if (value.IsNumeric())
{
setCell(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the same parsing be done here like for the Xlsx2Serializer?

double numericValue = double.Parse(value, CultureInfo.InvariantCulture);

@oyessb

oyessb commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

@likp I have made tests for both XlsxSerializer and Xlsx2Serializer to check if the cell datatype is Number for numeric values. Is it okay if i push them to this branch together with the double.Parse(..) as mentioned in the comment above?

oyessb and others added 3 commits November 3, 2026 14:51
Updated code to parse numeric values with double.Parse and CultureInfo.InvariantCulture before setting cell values, ensuring correct number formatting in Excel sheets.
Added Xlsx2SerializerTest to verify numeric cells are written as Excel numbers using reflection for indentation logic. Added similar test to XlsxSerializerTest. Both use BE0101A1.px and assert numeric cells are XLDataType.Number. Minor refactoring and whitespace changes in XlsxSerializerTest.cs.
@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@likp
likp marked this pull request as ready for review November 3, 2026 14:23
@likp
likp requested a review from oyessb November 3, 2026 14:24

@oyessb oyessb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@MikaelNordberg MikaelNordberg left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@oyessb
oyessb merged commit 1d03860 into main Nov 3, 2026
11 of 13 checks passed
@oyessb
oyessb deleted the fix/values branch November 3, 2026 14:54
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.

Problem with format on cells in excel download

3 participants