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

Free Support Forum - aspose.com

Deleting portions of a document

I am interested in removing segments of a template document. In other words, if my document contains the following info:

Some title
Here is some text in the document.

I would like to be able to remove all text between the {my_id} and {/my_id}.

Does anyone have some sample code that might accomplish this? Or is there some other strategy that might accomplish the same thing?

Thanks for your help.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. There is no direct way to achieve this, however, it is possible to achieve. You can try using code provided here:


Also, if you have control over your document, you can use bookmark instead of placeholders. In case of using bookmarks, you can remove its content by simply clearing its text.

doc.Range.Bookmarks["myBookmark"].Text = "";

Best regards.