How do I Append One Document to Another document?
DocIO provide the support for importing one document into another document using two ways. One is by directly importing the content using ImportContent() method. Another one is by appending ole object to import the content. The following code snippet illustrates how to import one document into another document.
C#
//Directly importing the content of one document into another document
//Open the source document
WordDocumentsourceDocument = new WordDocument("Essential DocIO.doc");
//Open the destination document
WordDocumentdestDocument = new WordDocument("Essential PDF.doc");
//Imports the content of source document into destination document
destDocument.ImportContent(sourceDocument, true);
//Save the destination document
destDocument.Save("Sample.doc");
//Importing the content as OLE object into the another document
//opens the document
WordDocumentdocument = new WordDocument("Essential PDF.doc");
document.LastSection.AddParagraph();
document.LastSection.AddParagraph();
document.LastParagraph.AppendText("Essential DocIO.doc has been inserted as OLE Object");
document.LastSection.AddParagraph();
//Loads the picture (for OLE Object)
WPicturepic = new WPicture(document);
pic.LoadImage(System.Drawing.Image.FromFile("DocIO.jpg"));
//Appending the document as OLE Object into another document
WOleObjectoleObject = document.LastParagraph.AppendOleObject("Essential DocIO.doc", pic, OleObjectType.Word_97_2003_Document);
oleObject.DisplayAsIcon = true;
//Save the document
document.Save("Sample.doc");
VB
'Directly importing the content of one document into another document
'Open the source document
DimsourceDocument As New WordDocument("Essential DocIO.doc")
'Open the destination document
DimdestDocument As New WordDocument("Essential PDF.doc")
'Imports the content of source document into destination document
destDocument.ImportContent(sourceDocument, True)
'Save the destination document
destDocument.Save("Sample.doc")
'Importing the content as OLE object into the another document
'opens the document
Dimdocument As New WordDocument("Essential PDF.doc")
document.LastSection.AddParagraph()
document.LastSection.AddParagraph()
document.LastParagraph.AppendText("Essential DocIO.doc has been inserted as OLE Object")
document.LastSection.AddParagraph()
'Loads the picture (for OLE Object)
Dimpic As New WPicture(document)
pic.LoadImage(System.Drawing.Image.FromFile("DocIO.jpg"))
'Appending the document as OLE Object into another document
DimoleObject As WOleObject = document.LastParagraph.AppendOleObject("Essential DocIO.doc", pic, OleObjectType.Word_97_2003_Document)
oleObject.DisplayAsIcon = True
'Save the document
document.Save("Sample.doc")
The following sample illustrates the above code
http://help.syncfusion.com/samples/DocIO.Web/DocIOWebSamples/ImportDocument/main.htm