//Code for Joining Multiple Documents Together [C#] // The document that the other documents will be appended to. Document doc = new Document(); // We should call this method to clear this document of any existing content. doc.RemoveAllChildren(); int recordCount = 5; for (int i = 1; i <= recordCount; i++) { // Open the document to join. Document srcDoc = new Document(@"C:\DetailsList.doc"); // Append the source document at the end of the destination document. doc.AppendDocument(srcDoc, ImportFormatMode.UseDestinationStyles); // In automation you were required to insert a new section break at this point, however in Aspose.Words we // don't need to do anything here as the appended document is imported as separate sectons already. // If this is the second document or above being appended then unlink all headers footers in this section // from the headers and footers of the previous section. if (i > 1) doc.Sections[i].HeadersFooters.LinkToPrevious(false); } [VB.NET] ' The document that the other documents will be appended to. Dim doc As New Document() ' We should call this method to clear this document of any existing content. doc.RemoveAllChildren() Dim recordCount As Integer = 5 For i As Integer = 1 To recordCount ' Open the document to join. Dim srcDoc As New Document("C:\DetailsList.doc") ' Append the source document at the end of the destination document. doc.AppendDocument(srcDoc, ImportFormatMode.UseDestinationStyles) ' In automation you were required to insert a new section break at this point, however in Aspose.Words we ' don't need to do anything here as the appended document is imported as separate sectons already. ' If this is the second document or above being appended then unlink all headers footers in this section ' from the headers and footers of the previous section. If i > 1 Then doc.Sections(i).HeadersFooters.LinkToPrevious(False) End If Next i