I have a problem with a source .docx file, containing a simple floating textbox anchored between images that are inserted by Aspose, when outputing to .doc
The .doc file is output by Aspose without any errors, however when the resulting document is edited and saved and then re-opened Word claimes the document is corrupt (see attached screenshot). Applying the same edits to the source document results in a good document.
I am running Aspose 8.2, Word 2007
Replicating the issue:
-
Use the uploaded document bug.docx and the uploaded image test.jpg along with the code shown below.
-
Run the code to generate bugout.doc
-
Open bugout.doc in Word, move to the end of the document and add a drawing canvas, then draw 5 or more lines on the drawing canvas.
-
Save the document
-
Open the document again- document is corrupt.
Code:
Sub bug()
Try
'
' get Aspose licence
'
Dim license As Aspose.Words.License = New Aspose.Words.License()
license.SetLicense("E:\Aspose.Words.lic")
'
' Get master document (the first one in the list)
'
Dim doc As Aspose.Words.Document = New Document("E:\bug.docx")
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
Dim bookmarks As BookmarkCollection = doc.Range.Bookmarks
For Each bookmark As Bookmark In bookmarks
builder.MoveToBookmark(bookmark.Name)
builder.InsertImage("E:\test.jpg", 100, 100)
Next
'
' Save document
'
doc.Save("E:\bugout.doc")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub