This topic discusses how to programmatically join and append documents using Aspose.Words. Appending documents is a very common task, one which is fully supported. Using Aspose.Words you can easily append one document to another using just a one line API call.
This topic provides details and code examples on how to append documents and how to further control how the documents are joined. For instance, there are examples which show how to set an appended document to appear on the next page and how to restart the page numbering in the pages that are joined.
When appending documents the destination document is the base document to which the content from the source document is imported into. These are common terms used frequently in the context of appending and copying content from document to document.
Each sample below shows how to append documents with different options. In these samples we will be using these two main documents along with a few variants of them in order to demonstrate the different techniques outlined in this article.
The content of the destination document is below. In the code this is loaded into a Document object referenced as “dstDoc” in our code. This document serves as the base document to which the source document is appended on to.
The content of the source document is found below. In the code this also will be loaded into a Document object and referenced as “srcDoc”. This document is what will be appended to the destination document.