Apr 20, 2015 at 1:15 PM
Edited Apr 20, 2015 at 4:21 PM
I would like to ask you for an advise. I want to delete a content from my template file. This file consist of text, tables and pictures. I have tried to use bookmarks according to this example
. My modified code is:
foreach (var paragraph in TemplateDoc.Paragraphs)
var bookmark = paragraph.GetBookmarks().FirstOrDefault(x => x.Name == "Bookmark1");
if (bookmark != null)
The problem is, that this delete only text and pictures without labels (which I have included in the selection while creating the bookmark). And when a bookmark points to a table, the ".docX" document gets corrupted.
So I would like to ask, what do you think is the best way to change the document by deleting its parts. I really like the idea when I use the bookmarks and delete the content which was selected by the bookmark, but how to achieve it? :)
Thank you for any advice.
is one solution for "marking" a text, but it is only for Word 2010 and higher.