I am writing a C # program that should export List<MyObject>to Excel, and I use EPPlus for this.
My problem is that my object has a property:
string Prop1 { get; set; }
And one of the values ββthat I need to export has a value that, for example, has the form Prop1 = "123E4".
The problem is that the EPPlus method LoadFromCollectionexports this to Excel, but Excel converts it to a number using scientific notation (output value = 1.23E+06or 1230000).
I tried to set the entire column to .Style.Numberformat.Format = "@"(and any other style I could think of), and even tried to set the style before and after the method call LoadFromCollection.
I also tried preceding the line with the character ', but actually saves that character in every cell inside this column, and then makes the values ββincorrect for analysis.
I play with converting my list to a DataTable to use the method LoadFromDataTable, but even this does not seem to work.
Any ideas / suggestions on how I can export this as clear text
source
share