Hello, I am using a temp license for our client.
Im trying to delete any content between tags , from starttag to endtag, in c# net
I´m trying to: (as seen in Remove text between two words)
- Implement IReplacingCallback interface and use Range.Replace method to find the text “<text1_start>”.
- In the IReplacingCallback.Replacing , insert the BookmarkStart node of a bookmark e.g. bookmark1 at the position of matched node.
- Similarly, find the text “<text1_end>” and insert BookmarkEnd node for same bookmark.
4). Use Bookmark.Text to set the bookmark text to empty string to remove the contents of bookmark.
I can already manage to find a text and insert a bookmarkStart using what I found at https://docs.aspose.com/display/wordsnet/Find+and+Replace#FindandReplace-HowtoFindandHighlightText
The problem is when I make a second search (of endtag in order to insert bookmarkend), it throws an Exception: “aspose startindex cannot be larger than lengh of string”
This is thrown at SplitRun function at “run.Text.Substring(0, position)”.
I seached a lot for this problem and I only found Range.replace question wich is obsolete.
please can you help me?