Skip first occurrence of text | Find and replace text using .NET

Step 1: Start and End Tags are duplicated in document
like in input document , possiblity to have different tags in same document with duplicate and without duplicate.

currently checking for string[0] tag count =1 in sample project but no change in response.Source.zip (71.6 KB)

Expected
if same tags count > 0 then
In first finding start and end tag delete data inside tags and remove the duplicates tags with data
else
Skip

@saranyasrinivasan92

In this use case, you can use the same code example shared in your other threads. You just need to skip the first bookmark and set the text of other bookmarks to empty string. Please check the following code snippet.

The int j = 2 instead of int j = 1.

for (int j = 2; j < doc.Range.Bookmarks.Count; j++)
{
    Bookmark bookmark = doc.Range.Bookmarks[j];
    bookmark.Text = "";
} 

In your uses cases, you need to bookmark the content (start and end tags). This step is same in all cases. Second step is to remove the content. You can achieve it using Bookmark.Text property. The code example is almost same with a little modification.

Please let us know if you face any issue while using Aspose.Words.