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

Conversion from .NET format strings to Excel format strings? #19

Open
madelson opened this issue Feb 20, 2020 · 1 comment
Open

Conversion from .NET format strings to Excel format strings? #19

madelson opened this issue Feb 20, 2020 · 1 comment

Comments

@madelson
Copy link

Hi @andersnm,

This is probably out of scope for the library, but given that you are likely knowledgeable on the subject I thought I'd ask.

I have an app which allows format strings to be configured by an admin for how different numeric values are displayed in the UI. We use .NET format strings for this purpose. However, I want to support exports and be as faithful as possible in converting the .NET format string to an Excel one.

The two formatting "languages" are similar but not the same. I'm considering using your library to "TryParse" the .NET format string and see if it happens to be compatible with Excel as a first step. Does the library do enough validation for this to work?

Also, I'm generally curious whether you've seen this use-case or problem before and if there are any robust solutions you've encountered.

Thanks in advance,
Mike

@andersnm
Copy link
Owner

Hi @madelson,

I know there are many similarities between the .NET and Excel formats such that many strings work with either, but I'm also pretty sure there are sufficient differences that it wouldn't be a robust solution. ExcelNumberFormat would likely allow and interpret any .NET-format-specific tokens as literals. Alas I don't have any details or examples off the top of my head.

Lately there's been a couple indirect requests to convert certain number formats from .NET to Excel in the ExcelDataReader project, although for this I am considering a more specialized converter rather than a general one. I'm not aware of any existing solutions, but haven't looked much. ExcelDataReader/ExcelDataReader#461 (comment)

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

No branches or pull requests

2 participants