C#: Online Guide
How To: excel SDK
Text Search
Home ›› XDoc.Excel ›› C# Excel: Text Search

C# Excel - Search and Find Text in Excel

Learn How to Search Text in Excel Document and Obtain Text Content and Location Information


RasterEdge XDoc.Excel for .NET allows C# programmers to integrate text search functionality into their Excel document management application. To be specific, using mature C#.NET APIs, programmers can achieve following aspects. merge pdf files in asp.net c#, barcode reader using c#.net, libtiff c#, ghostscript pdf page count c#, how to add header in pdf using itextsharp in c#, code 128 barcode reader c#.

Related .net document control helps:
asp.net annotate pdf using c#: ASP.NET Annotate PDF Control: annotate, comment, markup PDF document online using ASP.NET C#
c# asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net mvc pdf editor control: ASP.NET MVC PDF Viewer & Editor: view, annotate, redact, edit PDF document in C# ASP.NET MVC
asp.net sharepoint document viewer control: ASP.NET SharePoint Document Viewer: view, annotate, redact documents in SharePoint
asp.net view text file in browser: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net edit pdf image using c#: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#
asp.net pdf document viewer c#: ASP.NET PDF Document Viewer in C#: open, display, view, annotate, redact Adobe PDF files online in ASP.NET MVC & WebForm...

Easy to search and find text content and get its location details

Allow to search defined Excel file page or the whole document

Support search Excel file with various search options, like whole Excel, ignore case, match string, etc. vb.net split pdf, vb.net fill pdf form, convert csv to pdf c#, edit pdf file using itextsharp c#, convert pdf to tiff in c#, c# resize pdf page, add text to pdf vb.net.

C# PDF: Example of Finding Text

Add references:



Using namespace:

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.Excel;

  using RasterEdge.Imaging.Basic.TextSearch;

The following C# coding example illustrates how to perform Excel text searching function in your .NET project, including setting search option, creating search result, and saving the result. pdf viewer in mvc 4, show image in repeater asp.net, pdf preview in asp.net c#, pdf editor asp.net, how to upload pdf file in database using asp.net c#, open word document in asp.net c#, asp.net display excel spreadsheet.

internal static void TestSearch(String fileName, String matchString, String cacheFile)

// Set search options.
RESearchOption option = new RESearchOption();
option.WholeWord = true;
option.IgnoreCase = true;
option.ContextExpansion = 30;

// It will create a cach file if your PDF document is never been searched before. 
if (!File.Exists(fileName))
BaseDocument document = getBaseDocument(TestFilePath.InputFilePath + fileName);
document.CacheSearchInfo(TestFilePath.InputFilePath + cacheFile);

// Create search result.
SearchResult sResult = new SearchResult();

// Search and store the result in the entity of search structure.
BaseDocument.Search(TestFilePath.InputFilePath + cacheFile, option, sResult);

private static BaseDocument getBaseDocument(String filePath)
BaseDocument document = null;
if (filePath.EndsWith(".pdf"))
document = new PDFDocument(filePath);
else if (filePath.EndsWith(".docx"))
document = new DOCXDocument(filePath);
else if (filePath.EndsWith(".xlsx"))
document = new XLSXDocument(filePath);
else if (filePath.EndsWith(".pptx"))
document = new PPTXDocument(filePath);
return document;