Issue with Find Options

When I use the find options object and set the LookinType as MATCH_ENTIRE I get an error when running the program. It says the Lookin type is not valid.

Please help.

Thank you

Sam

Hi Sam,

Thanks for your inquiry.

Please use FindOptions.setMatchType() instead of setLookinType() method if you are utilizing MATCH_ENTIRE search crieteria.

May the following sample code help you for your need, kindly refer to it.

Sample code:

//Instantiating a Workbook object
Workbook workbook = new Workbook();
//Opening the Excel file
workbook.open("e:\\files\\fBook1.xls");
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.getWorksheets().getSheet(0);
//Finding the cell containing the specified formula
Cells cells = worksheet.getCells();
FindOptions findOptions = new FindOptions();
findOptions.setMatchType(FindOptions.MATCH_ENTIRE);
Cell cell = cells.find("KDSL",null,findOptions);
//Printing the name of the cell found after searching worksheet
System.out.println("Name of the cell containing formula: " + cell.getName());

Thank you.

Hi Amjad,

That worked. Thank you

Sam