Merge DOTM

How to merge DOTM files in C#

GroupDocs.Merger allows developers to merge DOTM files when it’s needed to organize multiple DOTM files into single document or send fewer attachments etc. And you can do this without¬†any third-party software or manual work involved. With GroupDocs.Merger it is possible to combine DOTM documents of any size and structure - all text, images, tables, graphs, forms and other content will be preserved.

The following example demonstrates how to merge DOTM files with several lines of C# code:

  • Create an instance of Merger class and pass source DOTM file path as a constructor parameter. You may specify absolute or relative file path as per your requirements.
  • Add another DOTM file to merge with Join method. Repeat this step for other DOTM documents you want to merge.
  • Call Merger class Save method and specify the filename for the merged DOTM file as parameter.
// Load the source DOTM file
using (Merger merger = new Merger(@"c:\sample1.dotm"))
{
    // Add another DOTM file to merge
    merger.Join(@"c:\sample2.dotm");
    // Merge DOTM files ans save result
    merger.Save(@"c:\merged.dotm");
}

About DOTM File Format

A file with DOTM extension represents template file created with Microsoft Word 2007 or higher. It is similar to the popular DOCX file format other than it retains the user defined settings for reuse in case of creating new documents. Such documents are more often used in offices where a standard template file is generated with settings like page information, margins, default layout and macros, and is used to create new documents from it when required. DOTM files, however, save macros, that are a series of commands in the form of recorded actions for automatic completion of a task. This helps save time in carrying out actions that are repeated in completion of a task.

Code Examples

Please find more use-cases and complete C# sources of our backend and frontend examples and try them for free!

Merge DOTM Live Demo

GroupDocs.Merger for .NET provides an online DOTM Merger App, which allows you to try it for free and check its quality and accuracy.

“Merge DOTM”