在xlsx4j中查找单元格中的值
Contents
[
Hide
]
Aspose.Cells - 在单元格中查找数值
在Microsoft Excel中,用户可以搜索包含特定数据的单元格。例如,点击编辑然后查找打开搜索对话框。用户输入一个值并点击确定来搜索它。Excel会高亮显示匹配字段。
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());
下载运行代码
下载示例代码
更多详情,请访问查找或搜索数据。