Attached Word document is loaded into Aspose Document object.
Add a bookmark to surround/encapsulate the document.
Prior to the .Save, the bookmark count is correct at 1. After the .Save, the bookmark count is 0 and the inserted bookmark is no longer in the document or in the datastream output from the .Save.
We use the bookmarks when a user saves the document back into our system to identify the one to many pieces of content being returned. So, without the bookmark we cannot identify what is being returned to our system. This breaks our entire content editing process/model.
This does not happen all the time. So, there must be something unique about the attached document that the Aspose Word engine is detecting or failing on and inadvertently removing the bookmark during the .Save operation.
This is very time-critical since we are announcing GA release of this release of our product this coming week.
Please advise ASAP.
Following is the code.....
Dim BLOBDoc As Document
BLOBDoc = New Document("C:\\Tmp\\Share\\BookMarksDeleted.doc")
Dim blobBuilder As New DocumentBuilder(BLOBDoc)
blobBuilder.MoveToDocumentStart()
blobBuilder.StartBookmark("ContentExport_" & contentItem.ContentID)
blobBuilder.MoveToDocumentEnd()
blobBuilder.EndBookmark("ContentExport_" & contentItem.ContentID)
Dim preSaveBookmarks As Integer = BLOBDoc.Range.Bookmarks.Count
Using dataStream As New System.IO.MemoryStream
BLOBDoc.Save(dataStream, SaveFormat.Doc)
End Using
Dim postSaveBookmarks As Integer = BLOBDoc.Range.Bookmarks.Count