JanKallman / EPPlus

Create advanced Excel spreadsheets using .NET
3.76k stars 1.18k forks source link

Possibility to manage cells warning errors, like "Number Stored as Text" or "Two Digit Text Year". #152

Open romcode opened 6 years ago

romcode commented 6 years ago

Hi, I think that with current EPPlus version there is no way to avoid excell message wargings like "Number Stored as Text" or "Two Digit Text Year".

These settings are in the Microsfot Office DocumentFormat.OpenXml.Spreadsheet namespace, but I think there is no EPPlus "interface" for them.

Microsoft doc: https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.ignorederror(v=office.14).aspx

Making a quick google search, I've found an interesting solution from a StackOverflow user that I've proved and works like a charm.

Would you mind to add it to EPPlus?

Credits to briddums user ( https://stackoverflow.com/users/260473/briddums )

Solution Explained: https://stackoverflow.com/questions/11858109/using-epplus-excel-how-to-ignore-excel-error-checking-or-remove-green-tag-on-t/14483234#14483234

I think there are only a couple of minor changes to do, like:

  1. use "internal" keyword instead of "public"

    internal ExcelIgnoredError _ignoredError;

  2. Add code to the "Dispose" method

     _ignoredError = null;

Best regards.

saravan23 commented 5 years ago

Is there any ETA to fix this issue?

mason-mcglothlin commented 5 years ago

I would also be interested in seeing a fix for this.

For example, we have various sets of data that we export into Excel. One of the columns is called "Claim TOB". It can have values like 111, 117, 1B1. Each of those are strings, even though some of them are only composed of numeric characters. Even if the data type I assign to a cell's Value is a string, Excel still displays the warning that it's a number stored as text for the 111 and 117 values.

If I open the file up in Excel, I'm able to override the warning on a per-cell basis. But since EPPlus exposes no programmatic way of overriding the warning, this doesn't work for the reports our end users downloaded from our site.