We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

XlsIO component and removing blank cells

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.

  

1 Reply

AV Abirami Varadharajan Syncfusion Team June 10, 2019 01:45 PM UTC

Hi Davide, 
  
Greetings from Syncfusion. 
  
We have prepared sample to remove blank rows in between and at the end. Please find the sample from the following link. 
  
  
Kindly check and let us know if your requirement has been fulfilled. 
  
Regards, 
Abirami 
  



Loader.
Live Chat Icon For mobile
Up arrow icon