We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problem with bookmark insertion

Hi,
We have been facing an issue inserting a bookmark at the document start when the first paragraph of the document contains a textbox (or in general, a shape). When we use the API to move to the document start and insert a bookmark, we see that a bookmark is inserted as part of the document xml but it isn’t part of the word bookmark layout (can’t see it in Word). Attaching the input and generated documents for your reference.

Document doc = new Document(path+"Textbox.docx");
DocumentBuilder db = new DocumentBuilder(doc);
db.moveToDocumentStart();
db.startBookmark("START_1");
db.endBookmark("START_1");
db.save(path+"TADA.docs");

Hi Praneeth,

Thanks for your inquiry.

I have tested the scenario and have managed to reproduce the same issue at my side. For the sake of correction, I have logged this problem in our issue tracking system as WORDSNET-10572. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Please use the following workaround for this issue. Hope this helps you.

Document doc = new Document(MyDir + "Textbox.docx");
DocumentBuilder db = new DocumentBuilder(doc);
db.moveToDocumentStart();
db.write(" ");
db.startBookmark("START_1");
db.endBookmark("START_1");
doc.save(MyDir + "TADA.docx");

The issues you have found earlier (filed as WORDSNET-10572) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.