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

Free Support Forum - aspose.com

Need a way to add or remove paragraphs in the middle of documents


We have around 500 Word templates, that we use Aspose to perform merges on. A new requirement has been added to new templates that will be created.

  1. Ability to remove specific paragraphs. These paragraphs that may need to be removed are specified. So, we know which paragraphs may need to be deleted.

  2. Ability to add a paragraph into a location.

Notes: Sections and pages are not reliable, because other documents are sometimes merged into the master document. I need to get to the location, without using sections, because the section could be different in different templates. I realized, that I could use bookmarks to do this.


  1. Can I find a bookmark in the document, without knowing the section or page?
  2. Can I add a paragraph, or remove a paragraph, right after this bookmark?
  3. Do you have any other suggestion for doing this?

Thanks for your request. You are absolutely right, you can achieve what you need using bookmarks. You can use DocumentBuilder to move cursor to the bookmark. For example see the following code:

// Open document and create DocumentBuilder
Document doc = new Document(@"Test100\in.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
// Move cursor to the bookmark
// Remove current paragraph
// Save output document

Also see the following link to learn more about bookmarks
Best regards.