PNG JPG BMP TIFF DOCX
  Product Family

Search DOCX Formats in C#

Native and high performance Microsoft Word DOCX file search using server-side .NET APIs, without the use of any software like Microsoft or Adobe PDF.

How to Search DOCX File Using C#

In order to search DOCX file, we’ll use

Aspose.Words for .NET

API which is a feature-rich, powerful and easy to use document searching API for C# platform. Open

NuGet

package manager, search for Aspose.Words and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Words

Steps to Search DOCX Files in C#

Developers can easily search Microsoft Word DOCX file by following the workflow.

  • Load DOCX document.
  • Just use Replace function to find and replace.
  • Also possible with Regex as parameter within Replace method
  • Save file.

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, Windows Azure, Mono or Xamarin Platforms
  • Development environment like Microsoft Visual Studio
  • Aspose.Words for .NET DLL referenced in your project - Install from NuGet using the Download button above
 

Search DOCX Files - C#

Document docx = new Document("../../data/document.docx");

// Replaces all "sad" and "mad" occurrences with "bad"
doc.Range.Replace("document", "document replaced", false, true);

// Replaces all "sad" and "mad" occurrences with "bad"
doc.Range.Replace(new Regex("[s|m]ad"), "bad");
doc.Save("replacedDocument.docx");  
 
  • .NET Words API can be used to load, view and convert Microsoft Word and OpenDocument Formats like DOC, DOCX, ODT to PDF, XPS, HTML and various other formats. You can also create new documents from scratch and save them in the supported formats. It is a standalone API that is suitable for server side and backend systems where high performance is required. It does not depend on any software like Microsoft or OpenOffice. ‎

    Online DOCX Search Live Demos

    Other Supported Search Formats

    Using C#, one can also search other formats including.

    DOC (Microsoft Word Binary Format)
    HTML (Hyper Text Markup Language)
    MHTML (Web Page Archive Format)
    ODT (OpenDocument Text File Format)
    OTT (OpenDocument Standard Format)
    RTF (Rich Text Format)
    TXT (Text Document)
    XHTML (XML Text Based Markup)