Hello
It's possibe to select an replace text between two Bookmarks (BMStart, BMEnd) on an existing document?
[BMStarart]Text Text Text[BMEnd]
Regards
Stefan
Document doc = new Document();
doc.LoadFromFile(@"..\..\test.docx");
BookmarksNavigator bookmarkNavigator = new BookmarksNavigator(doc);
bookmarkNavigator.MoveToBookmark("Two");
string text = "";
foreach (var items in bookmarkNavigator.GetBookmarkContent().BodyItems)
{
if (items is Paragraph)
{
foreach (var item in (items as Paragraph).ChildObjects)
{
if (item is TextRange)
{
text += (item as TextRange).Text;
}
}
}
}
string x = "hello world";
doc.Replace(text, x, false, true);
doc.SaveToFile("result5693.docx");