DocumentAppendDocument Method (Document, ImportFormatMode, ImportFormatOptions)

Appends the specified document to the end of this document.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.2
Syntax
public void AppendDocument(
	Document srcDoc,
	ImportFormatMode importFormatMode,
	ImportFormatOptions importFormatOptions
)

Parameters

srcDoc
Type: Aspose.WordsDocument
The document to append.
importFormatMode
Type: Aspose.WordsImportFormatMode
Specifies how to merge style formatting that clashes.
importFormatOptions
Type: Aspose.WordsImportFormatOptions
Allows to specify options that affect formatting of a result document.
Examples
Shows how to resolve styles behavior while append document.
// Open a document with text in a custom style and clone it
Document srcDoc = new Document(MyDir + "Custom list numbering.docx");
Document dstDoc = srcDoc.Clone();

// We now have two documents, each with an identical style named "CustomStyle" 
// We can change the text color of one of the styles
dstDoc.Styles["CustomStyle"].Font.Color = Color.DarkRed;

ImportFormatOptions options = new ImportFormatOptions();
// Specify that if numbering clashes in source and destination documents
// then a numbering from the source document will be used
options.KeepSourceNumbering = true;

// If we join two documents which have different styles that share the same name,
// we can resolve the style clash with an ImportFormatMode
dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepDifferentStyles, options);
dstDoc.UpdateListLabels();

dstDoc.Save(ArtifactsDir + "DocumentBuilder.ResolveStyleBehaviorWhileAppendDocument.docx");
See Also