Product Family

Create DOTM File via C++

Native and high performance Microsoft Word DOTM documents creation programmatically using C++ library.

Generating MS Word DOTM file dynamically within running application is easy. In order to create DOTM documents from scratch having similar result as of New document in Microsoft Word without requiring MS Office, we’ll use

Aspose.Words for C++

API that offers different features for document creation, manipulation and conversion using C++ platform. One can easily enhance code to insert images, text, lists, tables and other elements in newly created Word documents.

How to Create DOTM via C++

It is easy for the developers to creat, load, modify and convert DOTM files within running Word Automation applications for data processing in just few lines of code.

  1. Use Document class object for initialization.
  2. Create DocumentBuilder class object and initialize it with the Document object.
  3. Save the file using Save(.) method.

System Requirements

Before running the C++ conversion sample source code, make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
  • Aspose.Words for C++ DLL referenced in your project.

Following source code shows how to create a Word DOTM file using C++.

// Initializing a Document.
System::SharedPtr<Document> dotm = System::MakeObject<Document>();
// Document builder for adding content within the document.
System::SharedPtr<DocumentBuilder> bldr = System::MakeObject<DocumentBuilder>(dotm);
// Add all relevant content
bldr->Writeln(u"relevant content!"); 
// Save the document to any specified location.

// Enhance the code to edit or update the created Word DOTM file
// Add images, insert table and lists
A Document Processing Library to perform a wide range of document creation, management and manipulation tasks including DOTM generation, editing, conversion, rendering and printing. C++ Word library supports all of word-processing formats as well as allows exporting or converting DOTM to PDF, HTML, fixed-layout and most commonly used image & multimedia formats.

DOTM What is 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.

Read More

Other Supported Document Generation

You can also create other Microsoft Word files including few listed below.

DOC (Microsoft Word Binary Format)
DOCX (Office 2007+ Word Document)
RTF (Rich Text Format)
DOT (Microsoft Word Template Files)
DOTX (Microsoft Word Template File )
DOTM (Microsoft Word 2007+ Template File)
DOCM (Microsoft Word 2007 Marco File)
ODT (OpenDocument Text File Format)