Bookmark gets deleted automatically on downloading the document

Hi,
We use bookmark in the document to identify certain contents and wrap it up within content control.
In a particular use case where a bookmark is added just before the a normal table at the end of the document.
The Bookmark(hidden bookmark) doesn’t show up on downloading the document, even after checked a hidden bookmark checkbox.
When I initialize the org.aspose.word.Document instance with the same file and try to find the bookmarks, I get all as expected. but after downloading the document, bookmark just does not show up. What could be the possible reason behind it?

Document doc = new Document(in);
//Checking for bookmark deletion
logger.info(String.format("Bookmarks present in the template file for document ID: %s",
fileId));
for (com.aspose.words.Bookmark bookmark : doc.getRange().getBookmarks())
{
     logger.info(bookmark.getName());
}
logger.info(String.format(
"End of list of Bookmarks present in the template file for document ID : %s",
fileId));
//Some code
//Download the document. 
response.setCharacterEncoding("UTF-8");
outputStream = response.getOutputStream();
byte[] bytes = new byte[4 * 1024];
int read;
if (inputStream.markSupported())
	inputStream.reset();
while ((read = inputStream.read(bytes)) != -1)
{
	outputStream.write(bytes, 0, read);
}
outputStream.flush();

If needed I can send the document file to reproduce the issue.
I would appreciate any help.

@iContract123,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi,
Sorry for late reply, Please find the attached zip project(created using eclipse ide) including the original document and converted document.
Thanks in advance.

@iContract123,

Unfortunately, we have not found the attachment with your post. Please attach it again. Thanks for your cooperation.

It was due to our company policy.sorry for that.
Please find attached sample project along with the original and output document.

Last content control bookmark gets deleted when I call document.save().

@iContract123,

You have not attached the requested resources. Please check the attached image for upload button. upload.png (7.0 KB)

1 Like

Hi
I don’t know why the file is not getting uploaded.
Howevere let me try once again.
Please find attached.

@iContract123,

Unfortunately, we have not found the attachment in this thread. Please try some other browser or create new topic in Aspose.Words forum.

You can also upload the ZIP file to Dropbox and share the download link here for testing. Thanks for your cooperation.

Here it is the link to the file.
Aspose-sample-test-project

@iContract123,

Thanks for sharing the detail. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-17177. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17177) have been fixed in this Aspose.Words for .NET 18.9 update and this Aspose.Words for Java 18.9 update.