Overview Discover M2Doc

The M2Doc project provides Word document (.docx files) generation based on a document template and EMF models.

The overall approach consists in creating templates in the OOXML format where static text authoring benefits from the WYSIWYG capabilities of Microsoft Word. Dynamic parts are inserted using a dedicated vocabulary of OOXML fields code. Fields are mainly used to insert page numbers, references, etc. M2Doc makes use of them to describe documentation generation directives. This allows a total separation between the document and the M2Doc directives.


As an example, here is a fragment of a M2Doc template used to generate the documentation of a database model:

DB Template

The generation looks like this:

DB Result

The template language makes an extensive use of the Acceleo Query Language which provides a full-fledged, extensible model query language and engine. The M2Doc templates can be validated. If errors are found, an annotated templates is produced describing the problems found.

M2Doc Workflow

The architecture of M2Doc is organized around three building blocks:

  • Apache POI for the parsing and generation of OOXML documents
  • AQL for querying the models
  • EMF as a general platform

Technical architecture

You probably want to start with the Download section.