## MergerContext class

Document merger context.

```csharp
public class MergerContext : ProcessorContext
```

## Constructors

| Name | Description |
| --- | --- |
| [MergerContext](mergercontext/)() | The default constructor. |

## Properties

| Name | Description |
| --- | --- |
| [FontSettings](../../aspose.words.lowcode/processorcontext/fontsettings/) { get; set; } | Font settings used by the processor. |
| [LayoutOptions](../../aspose.words.lowcode/processorcontext/layoutoptions/) { get; } | Document layout options used by the processor. |
| [MergeFormatMode](../../aspose.words.lowcode/mergercontext/mergeformatmode/) { get; set; } | Specifies how to merge formatting that clashes. |
| [WarningCallback](../../aspose.words.lowcode/processorcontext/warningcallback/) { get; set; } | Warning callback used by the processor. |

## Examples

Shows how to merge documents into a single output document using context.

```csharp
//There is a several ways to merge documents:
string inputDoc1 = MyDir + "Big document.docx";
string inputDoc2 = MyDir + "Tables.docx";

MergerContext context = new MergerContext() { MergeFormatMode = MergeFormatMode.KeepSourceFormatting };

Merger.Create(context)
    .From(inputDoc1)
    .From(inputDoc2)
    .To(ArtifactsDir + "LowCode.MergeContextDocuments.1.docx")
    .Execute();

LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
MergerContext contextLoadOptions = new MergerContext() { MergeFormatMode = MergeFormatMode.KeepSourceFormatting };
Merger.Create(contextLoadOptions)
    .From(inputDoc1, firstLoadOptions)
    .From(inputDoc2, secondLoadOptions)
    .To(ArtifactsDir + "LowCode.MergeContextDocuments.2.docx", SaveFormat.Docx)
    .Execute();

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
MergerContext contextSaveOptions = new MergerContext() { MergeFormatMode = MergeFormatMode.KeepSourceFormatting };
Merger.Create(contextSaveOptions)
    .From(inputDoc1)
    .From(inputDoc2)
    .To(ArtifactsDir + "LowCode.MergeContextDocuments.3.docx", saveOptions)
    .Execute();
```

Shows how to merge documents from stream into a single output document using context.

```csharp
//There is a several ways to merge documents:
string inputDoc1 = MyDir + "Big document.docx";
string inputDoc2 = MyDir + "Tables.docx";

using (FileStream firstStreamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
    using (FileStream secondStreamIn = new FileStream(MyDir + "Tables.docx", FileMode.Open, FileAccess.Read))
    {
        OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
        using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamContextDocuments.1.docx", FileMode.Create, FileAccess.ReadWrite))
        {
            MergerContext context = new MergerContext() {MergeFormatMode = MergeFormatMode.KeepSourceFormatting};
            Merger.Create(context).From(firstStreamIn).From(secondStreamIn).To(streamOut, saveOptions).Execute();
        }

        LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
        LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
        using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamContextDocuments.2.docx", FileMode.Create, FileAccess.ReadWrite))
        {
            MergerContext context = new MergerContext() {MergeFormatMode = MergeFormatMode.KeepSourceFormatting};
            Merger.Create(context).From(firstStreamIn, firstLoadOptions).From(secondStreamIn, secondLoadOptions).To(streamOut, SaveFormat.Docx).Execute();
        }
    }
}
```

### See Also

* class [ProcessorContext](../processorcontext/)
* namespace [Aspose.Words.LowCode](../../aspose.words.lowcode/)
* assembly [Aspose.Words](../../)
