在单元格中查找数值

Aspose.Cells - 在单元格中查找数值

在Microsoft Excel中,用户可以搜索包含特定数据的单元格。例如,点击编辑然后查找打开搜索对话框。用户输入一个值并点击确定来搜索它。Excel会高亮显示匹配字段。

C#

 //Instantiating a Workbook object

Workbook workbook = new Workbook("../../data/test.xlsx");

//Accessing the first worksheet in the Excel file

Worksheet worksheet = workbook.Worksheets[0];

//Finding the cell containing the specified formula

Cells cells = worksheet.Cells;

//Instantiate FindOptions

FindOptions findOptions = new FindOptions();

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

findOptions.LookAtType = LookAtType.StartWith;

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

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

Console.WriteLine("Name of the cell containing String: " + cell.Name);

下载运行代码

从以下任一社交编码站点下载在单元格中查找数值