com.aspose.words
Class MergeFormatMode

java.lang.Object
    extended by com.aspose.words.MergeFormatMode

public class MergeFormatMode 
extends java.lang.Object

Utility class containing constants. Specifies how formatting is merged when combining multiple documents.

Example:

Shows how to merge documents into a single output document.
//There is a several ways to merge documents:
Merger.merge(getArtifactsDir() + "LowCode.MergeDocument.SimpleMerge.docx", new String[] { getMyDir() + "Big document.docx", getMyDir() + "Tables.docx" });

OoxmlSaveOptions ooxmlSaveOptions = new OoxmlSaveOptions();
ooxmlSaveOptions.setPassword("Aspose.Words");
Merger.merge(getArtifactsDir() + "LowCode.MergeDocument.SaveOptions.docx", new String[] { getMyDir() + "Big document.docx", getMyDir() + "Tables.docx" }, ooxmlSaveOptions, MergeFormatMode.KEEP_SOURCE_FORMATTING);

Merger.merge(getArtifactsDir() + "LowCode.MergeDocument.SaveFormat.pdf", new String[] { getMyDir() + "Big document.docx", getMyDir() + "Tables.docx" }, SaveFormat.PDF, MergeFormatMode.KEEP_SOURCE_LAYOUT);

Document doc = Merger.merge(new String[] { getMyDir() + "Big document.docx", getMyDir() + "Tables.docx" }, MergeFormatMode.MERGE_FORMATTING);
doc.save(getArtifactsDir() + "LowCode.MergeDocument.DocumentInstance.docx");

Field Summary
static final intMERGE_FORMATTING = 0
           Combine the formatting of the merged documents.
static final intKEEP_SOURCE_FORMATTING = 1
           Means that the source document will retain its original formatting, such as font styles, sizes, colors, indents, and any other formatting elements applied to its content.
static final intKEEP_SOURCE_LAYOUT = 2
           Preserve the layout of the original documents in the final document.
 

Field Detail

MERGE_FORMATTING = 0

public static final int MERGE_FORMATTING
Combine the formatting of the merged documents.

By using this option, Aspose.Words adapts the formatting of the first document to match the structure and appearance of the second document, but keeps some of the original formatting intact. This option is useful when you want to maintain the overall look and feel of the destination document but still retain certain formatting aspects from the original document.

This option does not have any affect when the input and the output formats are PDF.


KEEP_SOURCE_FORMATTING = 1

public static final int KEEP_SOURCE_FORMATTING
Means that the source document will retain its original formatting, such as font styles, sizes, colors, indents, and any other formatting elements applied to its content.

By using this option, you ensure that the copied content appears as it did in the original source, regardless of the formatting settings of the first document in merge queue.

This option does not have any affect when the input and the output formats are PDF.


KEEP_SOURCE_LAYOUT = 2

public static final int KEEP_SOURCE_LAYOUT
Preserve the layout of the original documents in the final document.

In general, it looks like you print out the original documents and manually adhere them together using glue.


See Also:
          Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
          Aspose.Words Support Forum - our preferred method of support.