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
mylicense.SetLicense("Aspose.Words.lic")
doc = New Document(System.IO.Path.GetFullPath("C:\a.doc"))
bldr = New DocumentBuilder(doc)
With bldr
.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary)
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
.CurrentParagraph.ParentNode.AppendChild(mychild)
Next mychild
End With
doc.Save("c:\OutDoc.doc")