PNG
JPG
BMP
TIFF
XLSX
Search XLSX Formats in C#
Native and high performance XLSX document search using server-side Aspose.Cells for .NET APIs, without the use of any software like Microsoft or Adobe PDF.
How to Search XLSX File Using C#
In order to search XLSX file, we’ll use
API which is a feature-rich, powerful and easy to use document searching API for C# platform. Open
package manager, search for Aspose.Cells and install. You may also use the following command from the Package Manager Console.
Command
PM> Install-Package Aspose.Cells
Steps to Search XLSX Files in C#
A basic document search with
APIs can be done with just few lines of code.
- Load XLSX file using Workbook class.
- Get the cells in relevant sheet.
- Search Numbers, Date and Text using Find method
System Requirements
Our APIs are supported on all major platforms and Operating Systems. Before executing the code below, please make sure that you have the following prerequisites on your system.
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Mono or Xamarin Platforms
- Development environment like Microsoft Visual Studio
- Add reference to the Aspose.Cells for .NET DLL in your project - Install from NuGet using the Download button above
Search XLSX Files - C#
// searching cells containing specified string value or number
Workbook workbook = new Workbook("book1.xlsx");
// get cells collection
Cells cells = workbook.Worksheets[0].Cells;
FindOptions opts = new FindOptions();
opts.LookInType = LookInType.Values;
opts.LookAtType = LookAtType.EntireContent;
// find the cell with the input integer or double
Cell cell1 = cells.Find(205, null, opts);
if (cell1 != null){
Console.WriteLine("Name of the cell containing the value: " + cell1.Name);
}else{
Console.WriteLine("Record not found ");
}
// find the cell with the input string
Aspose.Cells.Cell cell2 = cells.Find("Items A", null, opts);
if (cell2 != null){
Console.WriteLine("Name of the cell containing the value: " + cell2.Name);
}else{
Console.WriteLine("Record not found ");
}
// find the cell containing with the input string
opts.LookAtType = LookAtType.Contains;
Cell cell3 = cells.Find("Data", null, opts);
if (cell3 != null){
Console.WriteLine("Name of the cell containing the value: " + cell3.Name);
}else{
Console.WriteLine("Record not found ");
}