This project has moved and is read-only. For the latest updates, please go here.

Excel saved by EPPlus has problem

Jun 5, 2012 at 10:42 AM


when I load data using sheet.cells["A1"].LoadFromDataTable(_sourceDataTable, false, TableStyles.Custom);

and save the package, the excel file could not be opened again by EPPlus, and when I use Excel to open the file, it shows error message.

but when I use sheet.cells["A1"].LoadFromDataTable(_sourceDataTable, false);  -- without the 3rd parameter, the file can be re-opened by both EPPlus and Excel without problem.

I assume the TableStyles parameter may have caused some problem.

Jun 13, 2012 at 8:45 PM

Yes, TableStyles.Custom requires you to set valid a custom StyleName on the table. (and that requires you to have a template. You can't add custom table styles in EPPlus in the current release.)