Hi Aspose Team.
I having issues trying to find bookmarks embeded in a Word Template. Here is a sample application and the corresponding word template (attached).
The template should have 3 bookmarks: Test, Test1, and Test2. And in word if you go to the Bookmark list, you see them listed correctly. But I am only able to find one of them via aspose.
Document doc = new Document(@"in.dot");
DocumentBuilder builder = new DocumentBuilder(doc);
System.Console.WriteLine("Listing Bookmarks");
foreach (Bookmark bmk in builder.Document.Range.Bookmarks)
{
System.Console.WriteLine("bookmark name: " + bmk.Name);
}
string[] bookmarkKeys = new string[3] { "Test", "Test1", "Test2" };
foreach (string bookmarkKey in bookmarkKeys)
{
if (builder.MoveToBookmark(bookmarkKey))
{
System.Console.WriteLine("Found bookmark: {0}", bookmarkKey);
}
else
{
System.Console.WriteLine("Did NOT Find bookmark: {0}", bookmarkKey);
}
}
When I run this I get the following output:
Listing Bookmarks
bookmark name: Test2
Did NOT Find bookmark: Test
Did NOT Find bookmark: Test1
Found bookmark: Test2
Thank you for your help.