Shapes going haywire when combining documents


#1

I am combining a few documents together and it seems that my shapes and textboxes are moving all over the place. I have attached the documents I am using as source documents and then my final output.

Here is the code I used to combine them together:



Dim objLic As New Aspose.Word.License
objLic.SetLicense(Application.StartupPath & “\Aspose.Word.lic”)
Dim BODY As New Aspose.Word.Document(“C:\Documents and Settings\jkoerner\desktop\pre-test.doc”)

Dim db As New Aspose.Word.DocumentBuilder

db.Document.Sections.Clear()
'db.Document.Sections.Add(New Aspose.Word.Section(db.Document))

Dim objSource As Aspose.Word.Section
Dim objDest As Aspose.Word.Section
Dim i As Integer
For i = 0 To Body.Sections.Count - 1
If i <> 0 Then
objSource = BODY.Sections(i)
objDest = db.Document.ImportNode(objSource, True)
db.Document.Sections(db.Document.Sections.Count - 1).AppendContent(objDest)
Else
objSource = BODY.Sections(i)
objDest = db.Document.ImportNode(objSource, True)
db.Document.Sections.Add(objDest)
End If
Next


BODY = New Aspose.Word.Document(“C:\Documents and Settings\jkoerner\desktop\test.doc”)
For i = 0 To BODY.Sections.Count - 1
If i <> 0 Then
objSource = BODY.Sections(i)
objDest = db.Document.ImportNode(objSource, True)
db.Document.Sections(db.Document.Sections.Count - 1).AppendContent(objDest)
Else
objSource = BODY.Sections(i)
objDest = db.Document.ImportNode(objSource, True)
db.Document.Sections.Add(objDest)
End If
Next


db.Document.Save(“c:\Temp\Output.doc”)
Dim p As New Process
p.Start(“C:\Temp\output.doc”)



#2

Thank you for the report and code. Unfortunately, as I said in the previous post, some drawing layer objects can behave like this, particularly combining documents can easily screw them up. The only applicable workaround until we have them fully supported is either try to make them inline or use images instead.


#3

Thanks for the suggestion Dmity, but doing everything as Inline still results in the document re-arranging the textboxes on the first page of the document.

One of our biggest problems is that we have very little control over the source documents that are being feed to the program. The documents are created and maintained by the users. I can try and give them some guidelines on what they can and cannot use in the documents, however I would like to keep this list as minimal as possible.

Thanks,

John