Message-ID: <339169605.9871.1711705563570.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_9870_323158524.1711705563570" ------=_Part_9870_323158524.1711705563570 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
This sample uses the WordApplication class to open three existing=
documents and insert them into a new blank document. The InsertBefore() an=
d InsertAfter() methods are used, which accept an element from the current =
document or any other document, inserting it into the current document.
public void GenerateDocument() { // Initialize the WordApplication and create a blank document. WordApplication app =3D new WordApplication(); Document doc =3D app.Create(); // Open first document to merge Document doc1 =3D app.Open(@"..\..\WordTemplateFiles\mergedocuments1.= doc"); // Append first document doc.Append(doc1); // Open second document to merge Document doc2 =3D app.Open(@"..\..\WordTemplateFiles\mergedocuments2.= doc"); // Append second document doc.Append(doc2); // Open third document to merge Document doc3 =3D app.Open(@"..\..\WordTemplateFiles\mergedocuments3.= doc"); // Append third document doc.Append(doc3); // Save the merged document app.Save(doc, @"..\..\WordOutputFiles\MergedDocument_out.doc"); }=20
Files to be Merged:
Output File: Me= rgedDocument_out.doc