EPPlus
EPPlus copied to clipboard
BigInteger are shown as text in Excel
I had encountered a strange behavior in EPPlus 6.0.3 with BigIntegers.
By filling the sheet with LoadFromCollection where the list contains members of type BigInteger the corresponding columns in the Excel sheet are stored as text and Excel is warning with "Number stored as Text" -> https://stackoverflow.com/questions/33381121/how-can-i-remove-number-stored-as-text-prompt-upon-export-to-excel-using-epplu
After casting the BigInteger fields into regular integers everything works as expected.
public struct BigIntegerTest { public BigInteger Value { get; set; } };
worksheet.Cells[1, 1].LoadFromCollection(new BigIntegerTest[] { new BigIntegerTest { Value = 1 }, new BigIntegerTest { Value = 2 } }.ToList());
EPPlus will use the public instance members of the class/struct if not specified in the MemberInfo. In this case BigInteger has the following properties if set to for example 2: {2} IsEven: true IsOne: false IsPowerOfTwo: true IsZero: false Sign: 1
I suggest that you, if possible, converts your list to double instead as Excel and EPPlus works with double's anyway.