Free Support Forum - aspose.com

Missing Bookmark

Hello,

we have Microsoft Office Word 2003 SP3 documents with multiple bookmarks. When trying to get all bookmarks using Aspose.Words for Java, not all bookmarks will be present in the bookmark collection. In our test case one missing bookmark is concerning a table.
We tried the following versions release 4.0.3, release 10.0.1, release 10.1 without success.

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

It seems to be a similar problem like the published defects:

3140 - Bookmarks placed in a table cell not found.

3145 - Bookmark is lost when loading WordML document.

<A title=blocked::https://forum.aspose.com/t/119342

https://blog.aspose.com/2007/07/20/aspose-words-for-net-4-3-0-released

Our simple java implementation looks like this:

Document doc = new Document("test.doc");

BookmarkCollection bookmarks = doc.getRange().getBookmarks();

for (Object b : bookmarks) {

System.out.println("Bookmark: " + ((Bookmark)b).getName());

}

Bookmark b = bookmarks.get("HeaderTable");

if (b != null) { ... }

The missing bookmark "HeaderTable" is neither accessible by bookmarks.get("HeaderTable") nor by the BookmarkCollection. Please note that other bookmarks are accessible.

You can use the uploaded sample file to check the issue.

Now our questions:

- Is the way we try to read all bookmarks correct?

- Is this a new/know bug? When will it be fixed?

- Is there a workaround?

Thank you very much for your help.

Hello

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (10.1.0) and the following code for testing:

Document doc = new Document("C:\\Temp\\Test2.doc");

BookmarkCollection bookmarks = doc.getRange().getBookmarks();

for (Object b : bookmarks) {

System.out.println("Bookmark: " + ((Bookmark)b).getName());

}

Bookmark b = bookmarks.get("HeaderTable");

if (b != null) {

System.out.print("Ok " + b.getName());

}

My output is:

Bookmark: CSCBK_TMPL_LONGREPORT10

Bookmark: CSCBK_TMPL_LONGREPORT4

Bookmark: CSCBK_TMPL_LONGREPORT20

Bookmark: CSCBK_TMPL_LONGREPORT6

Bookmark: CSCBK_TMPL_LONGREPORT7

Bookmark: CS_INS3_COBA_MBRightSide27

Bookmark: CSCBK_TMPL_LONGREPORT8

Bookmark: CSCBK_TMPL_LONGREPORT9

Bookmark: TABLE_CS_INS1_COBA_KDataTable1

Bookmark: ROW_CS_INS1_COBA_KDataTable1

Bookmark: ROW_CS_INS1_COBA_KDataTable2

Bookmark: ROW_CS_INS1_COBA_KDataTable3

Bookmark: ROW_CS_INS1_COBA_KDataTable4

Bookmark: ROW_CS_INS1_COBA_KDataTable5

Bookmark: ROW_CS_INS1_COBA_KDataTable6

Bookmark: ROW_CS_INS1_COBA_KDataTable7

Bookmark: ROW_CS_INS1_COBA_KDataTable8

Bookmark: ROW_CS_INS1_COBA_KDataTable9

Bookmark: ROW_CS_INS1_COBA_KDataTable10

Bookmark: ROW_CS_INS1_COBA_KDataTable11

Bookmark: ROW_CS_INS1_COBA_KDataTable12

Bookmark: ROW_CS_INS1_COBA_KDataTable13

Bookmark: ROW_CS_INS1_COBA_KDataTable14

Bookmark: ROW_CS_INS1_COBA_KDataTable15

Bookmark: ROW_CS_INS1_COBA_KDataTable16

Bookmark: HeaderTable

Ok HeaderTable

Best regards,

Hello.

Thank you for the fast response. We tried it again with the same file that was attached to this thread and with Aspose.Words for Java 10.1.0 (5-30-2011) from the dowload section. We checked the following Java versions 1.5.0.12, 1.6.0.23 with the corresponding Aspose lib on the following operating systems: Windows XP SP3, Win 7 (32 bit) and Linux 2.6.18.2-34-default,i386

We still get the same issue. Please tell us the details from your test system.

Do you have a suggestion for the different results?

Best regards

Hi

Thank you for additional information. Most probably, you are using Aspose.Words in evaluation mode. That is why Aspose.Words truncates the document (one of evaluation limitations) and returns less number of bookmarks. You can request 30-days temporary license to evaluate Aspose.Words without evaluation version limitations:

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

Best regards,