We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Not able to find string values using Cell.find(str-null-findopt)

Hi,

Am using 8.2.2 latest version and am unable to find a string in excel using cells.find(). It is returning null value though the string is present in the excel.below is my code snippet

FindOptions fop = new FindOptions();
fop.setLookAtType(LookAtType.CONTAINS);
Cells cells=workbook.getWorksheets().get(0).getCells();
if(cells !=null){
System.out.println("found at "+cells.find("Updated By", null,fop));
}
else{
System.out.println("cell is null");
}

and am getting the result as

found at null

but the string "Updated By" is present in my excel sheet.

Hi,


Thank you for using Aspose APIs.

We have evaluated your presented scenario while using the latest version of Aspose.Cells for Java 8.2.2.1 against a sample spreadsheet of our own (attached). Unfortunately, we are unable to replicate the presented behavior with the Cells.find method as we have received the expected results by executing the following piece of code.

Java

Workbook book = new Workbook(“D:/temp/book1.xlsx”);
Worksheet sheet = book.getWorksheets().get(0);
FindOptions opt = new FindOptions();
opt.setLookAtType(LookAtType.CONTAINS);
opt.setLookInType(LookInType.VALUES);
Cell cell = sheet.getCells().find(“Updated By”, null, opt);
if(cell!=null)
{
System.out.println("found at " + cell.getName());
}

As we are not able to see the problem with our sample file so we think the issue could be template specific. We would request you to please provide your sample spreadsheet for further investigation.