Independentsoft
Home
Products
Purchase
Support
Downloads
Company
Contact
Word .NET
>
Tutorial
> Append document
The example shows you how to append content of one document to content of another document.
C# example
using System; using Independentsoft.Office; using Independentsoft.Office.Word; namespace Sample { class Program { static void Main(string[] args) { WordDocument first = new WordDocument("c:\\first.docx"); WordDocument second = new WordDocument("c:\\second.docx"); foreach (IBlockContent element in second.Body.Content) { first.Body.Add(element); } first.Save("c:\\first2.docx"); } } }
VB example
Imports System Imports Independentsoft.Office Imports Independentsoft.Office.Word Module Module1 Sub Main(ByVal args As String()) Dim first As New WordDocument("c:\first.docx") Dim second As New WordDocument("c:\second.docx") For Each element As IBlockContent In second.Body.Content first.Body.Add(element) Next first.Save("c:\first2.docx") End Sub End Module