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

Free Support Forum - aspose.com

How to read between two bookmarks and insert bookmarks in the same

Hi,

Please guide me how to read between two bookmarks and add bookmarks between the two bookmarks.

Please find attached test.doc and result.doc.
We need to read between the “start_doc” and “end_doc” bookmarks and add bookmarks on list items.
The test.doc is the document to be read and the result.doc is the expected output.

Thanks in advance.

Hi

Thanks for your inquiry. I think, in your case you should use DocumentVisitor to extract content between bookmarks from one document. Please follow the link to learn more about DocumentVisitor:
https://reference.aspose.com/words/java/com.aspose.words/DocumentVisitor
In your particular case, you should start collecting nodes when you visit BookmarkStart of the bookmark that mark start of region and end collecting nodes when visit BookmakEnd of bookmark that marks end of region.
Then you can insert collected nodes into the destination document. You can achieve this using the technique described here:
https://docs.aspose.com/words/java/insert-and-append-documents/
Hope this helps. Please let me know if you need more assistance, I will be glad to help you.
Best regards.