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

C# Word - Search and Find Text in Word

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


RasterEdge XDoc.Word for .NET allows C# programmers to integrate text search functionality into their Word document management application. print mvc view to pdf, c# convert pdf to tiff, how to read pdf file in asp.net c#, c# parse pdf data, mvc pdf, convert tiff to pdf c# itextsharp. To be specific, using mature C#.NET APIs, programmers can achieve following aspects.

Related .net document control helps:
asp.net pdf editor control: EdgePDF: ASP.NET PDF Editor Web Control: Online view, annotate, redact, edit, process, convert PDF documents
asp.net pdf viewer control: ASP.NET PDF Viewer Control: view, navigate, zoom Adobe PDF document in C# ASP.NET
asp.net image viewer zoom: ASP.NET Image Viewer Control(MVC & WebForms): view, annotate, redact, convert image files in html, JQuery
asp.net mvc document viewer: ASP.NET MVC Document Viewer: view, annotate, redact files on ASP.NET MVC web projects
asp.net mvc text file viewer: ASP.NET Text file viewer in MVC, WebForms: Open, view, annotate, convert txt files in C# ASP.NET
asp.net word document viewer: ASP.NET Office Word Document Viewer: view Word doc files online using C# in ASP.NET MVC web applications
asp.net edit pdf image: ASP.NET PDF Image Edit Control: online insert, edit PDF images in C#

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

Allow to search defined Word page or the whole document

Support searching Word file with various search options, like searching whole Word document, ignoring the letter case, matching string, etc. reduce pdf file size vb net, display pdf file in vb.net form, how to search text in pdf using c#, c# pdf file watermark, convert word to pdf vb.net, print pdf vb.net without acrobat, vb.net pdf ocr.

C# PDF: Example of Finding Text in Word

Add references:











Using namespaces:

  using RasterEdge.Imaging.Basic;

  using RasterEdge.XDoc.Word;

  using RasterEdge.Imaging.Basic.TextSearch;

The following C# coding example illustrates how to perform Word text searching function in your .NET project, including setting search option, creating search result and saving the result.http://localhost asp.net add text to pdf field, asp.net core pdf editor, asp.net pdf viewer disable save, excel viewer asp.net c#, asp.net view tiff image, asp net mvc generate pdf from view itextsharp, asp.net preview pdf.

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);
return document;