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

Free Support Forum - aspose.com

How to delete the remaining LINE_BREAK_CHAR following a CommentRangeEnd node?


In a word document, I try to delete all comment and corresponding commented content (nodes between CommentRangeStart and CommentRangeEnd of each comment).
When I remove a commented paragraph, a LINE_BREAK_CHAR or may be PARAGRAPH_BREAK_CHAR is remaining.
Is-it possible to remove those LINE_BREAK_CHAR or PARAGRAPH_BREAK_CHAR directly following a CommentRangeEnd node?
Hi Hervé,

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

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach the expected output Word file that shows the desired behavior.

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

PS: To attach these resources, please zip them and Click 'Reply' button that will bring you to the 'reply page' and there at the bottom you can include any attachments with that post by clicking the 'Add/Update' button.


in the simple example file template.xml, I use comment as processing instruction.
I remove with aspose words all commented text when comment is DELETE.
It works fine but I don’t know how to delete the the PARAGRAPH_BREAK_CHAR remaining behind the deleted text.


To solve the matter, before the doc processing I store all empty paragraphs in a list.
After processing, I get all empty paragraphs of my final doc and I remove all the ones that are not in my initial list.

Thank you
Hi Hervé,

Thanks for sharing the document.

Yes, you can use this approach to achieve your requirements. You may also check paragraph's text using Node.toString(SaveFormat.TEXT) method either it is empty or not after removing text between CommentRangeStart and CommentRangeEnd. If this method returns empty string, please remove the paragraph using Node.remove method.

Please let us know if you have any more queries.