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

Free Support Forum - aspose.com

How to find specific text fragments and replace content between them using Node.js


Is there any way i can replace text inside the document for example like: start 24, end 34… replace the text between 24 and 34 with my text and preserve the styling? Is there any way to enhance the conversion quality of doc -> html -> edit text in htlml -> convert back to docx/pdf

I’m working on an app where you select text which you want to replace later going through a questionnaire. Manipulating it via html doesn’t preserve the styling when converting back from html to docx. Is there a way i can manipulate the document directly?


Yes, you can replace the content between two specific text e.g. start24 and end 34 using Aspose.Words.

In your case, we suggest you please bookmark the content that you want to replace. Once you bookmark the content, please remove content using Bookmark.Text property. Move the cursor to the bookmark and insert the desired content.

Please read the following articles.

Find and Replace
Working with Bookmarks
Navigation with Cursor

If you want to keep the style of paragraph that is between start24 and end 34, please clone the paragraph using Node.Clone method and use its style in new content.

Thank you. Is there any documentation for bookmarks and nodejs?


Unfortunately, there is no documentation for Node.js. You can use Aspose.Words for .NET and Aspose.Words for Java to achieve your requirement.

You can use Aspose.Words Cloud Node.js. Hope this helps you.