I would like to delete all the rows where a specific string is found in any column of a row. But i am not sure how can this be done.
Thank you.
Workbook wb = new Workbook();
wb.LoadFromFile("test.xlsx");
Worksheet sheet = wb.Worksheets[0];
//Find cells with the specific string
CellRange[] textRanges = sheet.FindAllString("E-iceblue", false, false);
//Get the row index
List<int> rowIndex = new List<int>();
foreach(CellRange range in textRanges){
if (!rowIndex.Contains(range.Row))
{
rowIndex.Add(range.Row);
}
}
//Delete the corresponding rows
for (int i = 0; i < rowIndex.Count; i++ )
{
sheet.DeleteRow(rowIndex[i] - i);
}
wb.SaveToFile("result.xlsx", FileFormat.Version2013);