merge method

merge(output_file, input_files)

Merges the given input documents into a single output document using specified input and output file names.

def merge(self, output_file: str, input_files: List[str]):
    ...
ParameterTypeDescription
output_filestrThe output file name.
input_filesList[str]The input file names.

Remarks

By default MergeFormatMode.KEEP_SOURCE_FORMATTING is used.

merge(output_file, input_files, save_format, merge_format_mode)

Merges the given input documents into a single output document using specified input output file names and the final document format.

def merge(self, output_file: str, input_files: List[str], save_format: aspose.words.SaveFormat, merge_format_mode: aspose.words.lowcode.MergeFormatMode):
    ...
ParameterTypeDescription
output_filestrThe output file name.
input_filesList[str]The input file names.
save_formatSaveFormatThe save format.
merge_format_modeMergeFormatModeSpecifies how to merge formatting that clashes.

merge(output_file, input_files, save_options, merge_format_mode)

Merges the given input documents into a single output document using specified input output file names and save options.

def merge(self, output_file: str, input_files: List[str], save_options: aspose.words.saving.SaveOptions, merge_format_mode: aspose.words.lowcode.MergeFormatMode):
    ...
ParameterTypeDescription
output_filestrThe output file name.
input_filesList[str]The input file names.
save_optionsSaveOptionsThe save options.
merge_format_modeMergeFormatModeSpecifies how to merge formatting that clashes.

merge(input_files, merge_format_mode)

Merges the given input documents into a single document and returns Document instance of the final document.

def merge(self, input_files: List[str], merge_format_mode: aspose.words.lowcode.MergeFormatMode):
    ...
ParameterTypeDescription
input_filesList[str]The input file names.
merge_format_modeMergeFormatModeSpecifies how to merge formatting that clashes.

Examples

Shows how to merge documents into a single output document.

#There is a several ways to merge documents:
aw.lowcode.Merger.merge(output_file=ARTIFACTS_DIR + 'LowCode.MergeDocument.SimpleMerge.docx', input_files=[MY_DIR + 'Big document.docx', MY_DIR + 'Tables.docx'])
save_options = aw.saving.OoxmlSaveOptions()
save_options.password = 'Aspose.Words'
aw.lowcode.Merger.merge(output_file=ARTIFACTS_DIR + 'LowCode.MergeDocument.SaveOptions.docx', input_files=[MY_DIR + 'Big document.docx', MY_DIR + 'Tables.docx'], save_options=save_options, merge_format_mode=aw.lowcode.MergeFormatMode.KEEP_SOURCE_FORMATTING)
aw.lowcode.Merger.merge(output_file=ARTIFACTS_DIR + 'LowCode.MergeDocument.SaveFormat.pdf', input_files=[MY_DIR + 'Big document.docx', MY_DIR + 'Tables.docx'], save_format=aw.SaveFormat.PDF, merge_format_mode=aw.lowcode.MergeFormatMode.KEEP_SOURCE_LAYOUT)
doc = aw.lowcode.Merger.merge(input_files=[MY_DIR + 'Big document.docx', MY_DIR + 'Tables.docx'], merge_format_mode=aw.lowcode.MergeFormatMode.MERGE_FORMATTING)
doc.save(file_name=ARTIFACTS_DIR + 'LowCode.MergeDocument.DocumentInstance.docx')

See Also