0

I need to generate a excel file which range is not known, so I can't iterate through fixed range of columns/rows. So is there a way to iterate through the used cells in order to find all cells with text "V" using ClosedXML or OpenXML?

Toni
  • 57
  • 3
  • 15

3 Answers3

1

There is a pull request at https://github.com/ClosedXML/ClosedXML/pull/399 to help with this, for example:

 foundCells = ws.Search("searchText", CompareOptions.OrdinalIgnoreCase);
Francois Botha
  • 4,520
  • 1
  • 34
  • 46
0

In ClosedXML you can use something like this:

using (var cells = worksheet.CellsUsed(c => c.GetString() == "V"))
{
    foreach (var cell in cells)
    {
        // Do something with the cell ...
    }
}
Raidri
  • 17,258
  • 9
  • 62
  • 65
-1

You must opt for EPPlus, it is open source library to work with Excel and have good speed as compare to both either ClosedXML or OpenXML.

Vijay Raheja
  • 290
  • 2
  • 10