Removes Bookmarks from docx formats

Hi All,
Whenver I loads the Microsoft office “.docx” format file for updating contents using Aspose.Words version 4.0.3 all the existing bookmarks in the file gets deleted and number of pages gets increased.
It works ok for microsoft office “.doc” format.
To check this issue I just created the Document object and saved it again then also it removes the existing bookmarks.
Please let me know what is the solution to handle docx file formats.

Hello
Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (10.0.1). You can download this version from here:
https://releases.aspose.com/words/java
Could you please try using the latest version of Aspose.Words for Java and let me know how it goes on you side.
Best regards,

Hi,
Thanks for reply.
I have checked with latest version 10.0.1 but I’m getting below exception
sun.misc.ServiceConfigurationError: java.nio.charset.spi.CharsetProvider: Provider com.aspose.ms.java.utf7charset.provider.CharsetProvider not found
Some of the places I have seen that, this exception is occured when document format is not correct, but for me it is correct. i.e. doc and docx.
Please let me know the what is exact cause of this exception, or am I doing something wrong.

Hi,
I resolved the above exaception but still main problem is exist with latest Aspose.Words version (10.0.1).
It still removes all the existing bookmarks.

Hi
Thank you for additional information. Could you please provide me a sample document and code, which will allow me to reproduce the problem on my side? I will check the issue and provide you more information.
Best regards.

Hi,
Sorry, The document I’m using is confidential and can not be send outside. but you can just create any docx format document and insert some bookmarks in Header and at the end of the document .
For testing purpose my code is very simple, and not doing anything else, The code is here.
Just doing this two operation it removes the existing bookmarks from file.

objDocument = new Document("C://Test.docx");
objDocument.save("C://FromAsposeSave.docx");

Let me know if any more information you required.

Hi,
Just now I found that this issue is happening only for that document. if I create new document with some bookmarks it does not removes the bookmarks.
Can you tell me what can be the cause of it? Why this happens for that perticuler document.

Hi
Thank you for additional information. I have tested with Aspose.Words 10.0.1 and I still cannot reproduce the problem on my side. I use the following code for testing:

Document doc = new Document("C:\\Temp\\in.docx");
doc.save("C:\\Temp\\out.docx", SaveFormat.DOCX);

Please see the attached documents.
Best regards,

Hi,
Just now I found one cause of the issue, but dont understand why it is.
Whenever that document is having some comments (Track Changes and Comments from other user), and if those comments are not yet accepted, Aspose removes bookmarks from that document.
But if you accept those comments from word document and save it and then try with Aspose, it works perfectly fine and does not removes bookmarks from it.
Please can you tell me what can be the reason of such behaviour.

Hi
Could you please attach the input document you have problem with and the output document? You can remove any sensitive information by replacing it with dummy data instead.
Best regards,

If I replace the text from it and accept the deletion, it works fine. Something strange.
So wont be able to send that document.
I’ll take client permission and then will send document to you.

Hi
Thank you, I will wait for your document.
Best regards,

Hi,
Here is the document, check it in your environment and let me know the cause of issue.
Also delete the attached document once you get it.
Also I would like to onw thing, when we perform Aspose operation on Document content (Just load and save, no addition or deletion of content), Document Size get reduced. Why this behaviour?
Thanks

Hello
Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
Just for your information, it is not a bookmark inside your document header it is PAGE field and simple text.
Best regards,

Regarding document size; when you open document using Aspose.Words, this document is converted to Aspose.Words DOM. Please see the following link to learn more about Aspose.Words Document Object Model (DOM) and its relationships.
https://docs.aspose.com/words/net/aspose-words-document-object-model/
As you may know, any of MS Word formats are not strict formats, i.e. some properties/tags can be missed or the same thing can be done differently. That is why when you open save DOCX document using Aspose.Words size of document can be changed, because some of unnecessary tags are removed or some additional tags are added.
Best regards,

Hi,
Still my clinet facing the issue with Docx, Document gets changed after each save…
We are not able to trust document which is saved by Aspose.
Please reply ASAP.

Hi
Thanks for your inquiry. Unfortunately, the issue you have reported earlier is not yet resolved.
As a simple workaround, you can accept all revisions in your document using MS Word. After this, Aspose.Words can properly handle this document. There must be something with internal document structure that causes this issue.
Best regards,

Hi,

Please do you have any solution or workaround on this?
We are still facing this issue and now customer not able to rely on the documents as they are getting corrupted.

Waiting for you positive response.
Thanks

Pramod

Hi
Thanks for your request. I checked the issue with the latest version of Aspose.Words and it seems it is no longer reproducible. Could you please check on your side and confirm? You can download the latest version from here:
https://releases.aspose.com/words/net
Best regards,

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

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