Free Support Forum - aspose.com

Can not find bookmarks

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.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Most probably this occurs because you are using the evaluation version. Evaluation version of Aspose.Words (without a license specified) provides full product functionality, but it injects an evaluation watermark at the top of the document on open and save and limits the maximum document size to several hundred paragraphs.

If you want to test Aspose.Words without evaluation version limitations, you can also request a 30-Day Temporary License. See the following link for more information.

http://www.aspose.com/corporate/temporary-license.aspx

Best regards.