Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LoadFromDataTable Add data type detection For Excel Range #882

Open
minren118 opened this issue May 18, 2023 · 2 comments
Open

LoadFromDataTable Add data type detection For Excel Range #882

minren118 opened this issue May 18, 2023 · 2 comments
Assignees

Comments

@minren118
Copy link

Currently exporting Excel data, NumberFormat of Excel cell range is not set based on data type of DataTable

image

It is recommended to add the ability to specify Excel Range NumberFormat based on the DataTable data type, especially long integer fields. If String is specified in the DataTable and can be exported, NumberFormat is automatically set to "@" before exporting, so that the numbers can be displayed completely.

@JanKallman
Copy link
Contributor

You can set number formats via attributes if desired...https://github.com/EPPlusSoftware/EPPlus/wiki/LoadFromCollection-using-Attributes.
As we don't know what the desired number formats is from the data type, we can not set it that way.

@minren118
Copy link
Author

You're right, but if you still want to use LoadFromDataTable to do a lightweight export instead of defining a class that has specific definitions,

one of the biggest problems with the DataTable right now is that it's a text type. If I just let Excel determine the data type, it's easy to lose precision with long integer numbers.

I think I can rely on EPPLUS to convert the corresponding column to text type, Numberformat to @, when I finally write to Excel cells with a text type defined in the DataTable.

@swmal swmal self-assigned this May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants