I would like to transfer a Datatable
to excel and calculate a sum. For this I\'m using epplus. Here is my code:
Sheet.Cells[\"A1\"].LoadFromDataTable
After searching long time it seems that epplus
ignores the datatype if I use .LoadFromDataTable
and write every value as string
. So I have to parse every value to double and write it back into the cells. After that everything is running fine.
double ZahlAlsText;
for (int i = 2; i < totalCols; i++) 'columns
{
for (int y = 2; y <= letztezeile + 1; y++) 'rows
{
ZahlAlsText = double.Parse(range[y, i].Value.ToString());
range[y, i].Style.Numberformat.Format = "#,##0.00";
range[y, i].Value = ZahlAlsText;
}
}