Compartir a través de


DocumentBase.Merge(String, Object, Object, Object, Object) Method

Definition

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

public void Merge (string fileName, ref object mergeTarget, ref object detectFormatChanges, ref object useFormattingFrom, ref object addToRecentFiles);
member this.Merge : string * obj * obj * obj * obj -> unit
Public Sub Merge (fileName As String, Optional ByRef mergeTarget As Object, Optional ByRef detectFormatChanges As Object, Optional ByRef useFormattingFrom As Object, Optional ByRef addToRecentFiles As Object)

Parameters

fileName
String

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

mergeTarget
Object

One of the WdMergeTarget values.

detectFormatChanges
Object

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

useFormattingFrom
Object

One of the WdUseFormattingFrom values.

addToRecentFiles
Object

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

Examples

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);
}
Private Sub DocumentMerge()
    Me.Merge("C:\Docs\Sales2.docx", _
        MergeTarget:=Word.WdMergeTarget.wdMergeTargetCurrent, _
        DetectFormatChanges:=True, _
        UseFormattingFrom:=Word.WdUseFormattingFrom.wdFormattingFromCurrent, _
        AddToRecentFiles:=True)
End Sub

Remarks

Optional Parameters

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

Applies to