I am using EPPlus to edit an existing Excel file. It is working well but here goes the funny thing: When I save this file using EPPlus, the file's size is 51.0 KB. If I open the same file after editing it and save it manually, the size of the file is increased to 59.1 KB.
Anyone knows why does it happen?
Is there a way to avoid this behavior?
I mean, make EPPlus save this file on the real size of it (59.1 KB).
What is the difference between saving this file manually or using EPPlus?
Another observation that I've made is that when I open this file after editing it using EPPlus it takes more time to load the file then if I do it after manually saving it.
Here is my code:
FileInfo file = new FileInfo(@"C:\Desktop\MyExcelFile.xlsx");
using (var package = new ExcelPackage(file))
{
ExcelWorkbook workBook = package.Workbook;
ExcelWorksheet currentWorksheet = workBook.Worksheets.SingleOrDefault(w => w.Name == "MyWorkSheet");
currentWorksheet.Cells[2, 2].Value = "Value1";
currentWorksheet.Cells[3, 2].Value = "Value2";
currentWorksheet.Cells[2, 1].Value = "Value3";
currentWorksheet.Cells[3, 1].Value = "Value4";
package.Save();
}