I am separating an excel file with three sheets into three different excel file with one sheet of content each.
I found that the file size after removing the irrelevant sheets is not reducing much compare to the original excel file.
Do you have any idea on this?
Or is there any other option to separate those sheets?
Thanks in advanced.
- Code: Select all
for (int a = 0; a < wsConvert.ToInt32(totalSheetCount); a++)
{
workbook.LoadFromFile(oriFilePath);
for (int snum = workbook.Worksheets.Count - 1; snum >= 0; snum--)
{
if (snum != a)
{
workbook.Worksheets[snum].Remove();
}
}
string fullpath = savepath + Path.DirectorySeparatorChar + "sheet_" + a + ".xlsx";
workbook.SaveToFile(fullpath, ExcelVersion.Version2016);
}