Rechercher une valeur dans les cellules dans xlsx4j

Aspose.Cells - Trouver des valeurs dans les cellules

Dans Microsoft Excel, les utilisateurs peuvent rechercher des cellules contenant des données spécifiques. Par exemple, en cliquant sur Modifier puis sur Rechercher, cela ouvre la boîte de dialogue de recherche. Les utilisateurs saisissent une valeur et cliquent sur OK pour la rechercher. Excel met en surbrillance les champs correspondants.

Java

 //Instantiating a Workbook object

Workbook workbook = new Workbook("workbook.xls");

//Accessing the first worksheet in the Excel file

Worksheet worksheet = workbook.getWorksheets().get(0);

//Finding the cell containing the specified formula

Cells cells = worksheet.getCells();

//Instantiate FindOptions

FindOptions findOptions = new FindOptions();

//Finding the cell containing a string value that starts with "Or"

findOptions.setLookAtType(LookAtType.START_WITH);

Cell cell = cells.find("SH",null,findOptions);

//Printing the name of the cell found after searching worksheet

System.out.println("Name of the cell containing String: " + cell.getName());

Télécharger le code en cours d’exécution

Télécharger le code source d’exemple