Selecting text (Between bookmarks) and removing it

Hi there,
I’m looking to programatically take something like this: -
“the quick brown fox jumped over the lazy dog”
Then run some code and remove some words, as so: -
“the quick brown fox jumped over the dog”
Ideally I’d like to shove a bookmark at the beggining of some text and after it and remove a whole section (or another appropriate marking scheme).
“the quick brown fox jumped over the [lazy] dog”
Can anyone advise on the best way to do this.
Thanks,
Phil.

Hi Phil,
Thanks for your request. I think in your case you should use just one bookmark, which starts and ends around the content which should be removed. And then you can try using the following code to remove content inside a bookmark:

Document doc = new Document("Bookmark.doc");
// Use the indexer of the Bookmarks collection to obtain the desired bookmark.
Bookmark bookmark = doc.Range.Bookmarks["MyBookmark"];
// Clear bookmark text
bookmark.Text = string.Empty;

Best regards,

Andrey,
That works brilliantly - thank you :slight_smile:
Cheers,
Phil.