Hello,
i'm trying to manipulate an xlsx file which has an enormous amount of blank cells (coming from another application) and I need to clean it programmatically.
I've tried to do it by cycling through rows and cells.... but it takes really a lot of time (more than an hour).
I've also tried to "filter" all good cells with the following linq query:
IWorkbook workbookO = application.Workbooks.Open(@"<filename>");
IWorksheet sheetO = workbookO.Worksheets["<sheetname>"];
int cols = sheetO.Columns.Length;
int rows = sheetO.Rows.Length;
var source = sheetO.Range[1, 1, rows, cols].Cells.ToList().Where(x => !x.IsBlank);
in source I obtain all not blank cells and it's very fast, but I'm not able anymore to re-convert them in a IRange, maybe to create a new excel file with only those cells.
Any suggestion on how to solve this problem is apreciated.