We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Find Replace Word Document


I’m trying to replace a few tags in a word document, but it does not do the replace on all document matches.

This has to do with the format of the text in word?

How can I solve that?


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Please share your input document file.
  • Aspose.Words generated output DOCX file showing the undesired behavior
  • Please attach your expected document here for our reference. We will investigate the structure of your expected document as to how you want your final output be generated like.
  • Please create a standalone console application (source code without compilation errors) that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start further investigation into your issue and provide you more information. Thanks for your cooperation.

Thanks for your support.

But theres another situation, I dont understand how I a specific file from a list of files. This file its on a directory on my machine.

I´m already try with a specific file, it works,

But what im trying to do its different, because the file have a specific name. That name gives the clue of what file of the list needs to be inserted also i need to know the extension if its a PDF file or it is a CSV file or its a txt file.

Thank you for the support, regards!

Hi Ubaldo,

Thank you for the details. Each Aspose API supports a limited number of the file formats. You can detect supported file formats only, otherwise it’ll return an “Unknown” string. However, for the multiple Aspose APIs, you can apply checks in the code. Please refer to the following help topics: Detect the File Format using Aspose.Words API and Detect the File Format using Aspose.Cells API

In reference to the Aspose.Pdf API, please use the source code as below:
[.NET, C#]

Document doc = new Document(MyDir + "in.docx");

String PageText = "";

LayoutCollector lc = new LayoutCollector(doc);

// load the source file
PdfFileInfo info = new PdfFileInfo("C:/PDFTEST/34445.pdf");
// determine if the file is PDF

Please let us know in case of any confusion or questions.