We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Importing from body of one document to header of another

When importing the contents of the body of a source document into a HeaderFooter of the target document, the formatting of some of the runs is incorrectly altered. After running the sample code, compare CustomLetterHead.dot to OutDoc.doc. Note how the formatting of “WinsteadPC” is changed.

Dim mylicense As New License
doc = New Document(System.IO.Path.GetFullPath("C:\a.doc"))
bldr = New DocumentBuilder(doc)
With bldr
    Dim mydoc = New Document(System.IO.Path.GetFullPath("C:\CustomLetterHead.dot"))
    Dim mynode As Object = doc.ImportNode(mydoc.Sections(0).Body, True, ImportFormatMode.UseDestinationStyles)
    Dim childs As Node() = mynode.ChildNodes.ToArray
    For Each mychild In childs
    Next mychild
End With


Thanks for your inquiry. I cannot reproduce the problem on my side using the latest version of Aspose.Words (8.0.0). Could you please attach your output document here?
Also I attached my output document.
Best regards,

I opened my output document with Word 2002 and it display correctly, so it appears to be a Word 2000 issue only. I’ve attached the document as you requested.


Thank you for additional information. I tried opening your document using MS Word 2000 and it looks fine.
Best regards,

This only affects one of our customers. If they have users with W2000, I’ll figure out some workaround. Thanks for looking at it.