I am using aspose cells to look for values in an excel file.
My problem is that even though a values occurs several times in a file I am only able to find first instance.
My code is below and I would expect it to loop through sheets in excel file and search all content i a sheet but that does not seem to be the case. can you help please?
br
Hans Jørgen
FileStream fstream = new FileStream(path, FileMode.Open);
//Instantiating a Workbook object
//Opening the Excel file through the file stream
Workbook workbook = new Workbook(fstream);
Worksheet worksheet;
for (int i = 0; i < workbook.Worksheets.Count; i++)
{
worksheet = workbook.Worksheets[i];
FindOptions opts = new FindOptions();
opts.LookAtType = LookAtType.StartWith;
CellArea ca = new CellArea();
ca.StartRow = 0;
ca.StartColumn = 0;
ca.EndRow = worksheet.Cells.MaxDataRow;
ca.EndColumn = worksheet.Cells.MaxDataColumn;
opts.SetRange(ca);
Aspose.Cells.Cell cell1 = worksheet.Cells.Find("DQRC Cycle ", null, opts);
if (cell1 != null)
{
//we found our value and does whatever is needed
}
}