Expand Minimize

DocumentBase.Merge Method

Merges the changes marked with revision marks from one document to another.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public void Merge(
	string fileName,
	ref Object mergeTarget,
	ref Object detectFormatChanges,
	ref Object useFormattingFrom,
	ref Object addToRecentFiles
)

Parameters

fileName
Type: System.String

The name of the new file that includes the merged contents.

mergeTarget
Type: System.Object

One of the WdMergeTarget values.

detectFormatChanges
Type: System.Object

true to detect format changes in the document; otherwise, false.

useFormattingFrom
Type: System.Object

One of the WdUseFormattingFrom values.

addToRecentFiles
Type: System.Object

true to add to the recent files list; otherwise, false.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example uses the Merge method to merge the changes marked with revision marks in Sales2.docx into the document associated with the current project. This example assumes that the file Sales2.docx exists on the current computer in the folder C:\Docs. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentMerge()
{
    object MergeTarget = Word.WdMergeTarget.wdMergeTargetCurrent;
    object DetectFormatChanges = true;
    object UseFormattingFrom = 
        Word.WdUseFormattingFrom.wdFormattingFromCurrent;
    object AddToRecentFiles = true;

    this.Merge("C:\\Docs\\Sales2.docx", ref MergeTarget,
        ref DetectFormatChanges, ref UseFormattingFrom, 
        ref AddToRecentFiles);
}

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft