I am using the following code to build a document, however the background color of my header is changing to a blue color for no appearant reason:
|
Dim objLic As New Aspose.Word.License objLic.SetLicense(Application.StartupPath & “\Aspose.Word.lic”) Dim Head As New Aspose.Word.Document(“C:\Documents and Settings\JKoerner\Desktop\Header.doc”) Dim Body As New Aspose.Word.Document(“C:\Documents and Settings\JKoerner\Desktop\ReplaceTest2.doc”) Dim myNewDoc As New Aspose.Word.Document Dim objSource As Aspose.Word.Section Dim objDest As Aspose.Word.Section Dim tmpImportnode As Aspose.Word.Node Dim i As Integer myNewDoc.Sections.Clear() 'Add our content from our first document objSource = Body.Sections(0) objDest = myNewDoc.ImportNode(objSource, True) myNewDoc.Sections.Add(objDest) 'Find the header footer node in the source document and then import it into our current document For i = 0 To Head.Sections(0).ChildNodes.Count - 1 Select Case Head.Sections(0).ChildNodes(i).NodeType Case Aspose.Word.NodeType.HeaderFooter 'Import the header into the current document. tmpImportnode = myNewDoc.ImportNode(Head.Sections(0).ChildNodes(i), True) myNewDoc.Sections(myNewDoc.Sections.Count - 1).AppendChild(tmpImportnode) Exit For End Select Next myNewDoc.Save(“C:\Temp\output.doc”, Aspose.Word.SaveFormat.FormatDocument) Dim p As New Process p.Start(“C:\Temp\output.doc”) |