This library provides a command for appending other DOCX documents to the end of composed DOCX documents.

Commands of this library may only be used in DOCX document logic.


Appends the contents of the provided DOCX document at the end of the current document, possibly as a new section.

If the appended document is a template, it is composed before being appended. It can be Controller or Flow-based; if Flow-based, the Flow with the ID "compose" will be run. Commands in the appended template have access to all variables, except for external parameters, of this main template.

Note that appended templates are not permitted to append more documents. Therefore the following commands are not evaluated if encountered during composing of an appended template:

Please note that appending works in a slightly different manner depending on if the template is Flow- or Controller-based when there are multiple commands doing the appending. In a Flow, all appended documents always appear in the result document in the order that the commands are evaluated. In a Controller, the same thing happens by default, but the position attribute may also be used to control the order. The position attribute does nothing in a Flow.  

The appendSection command produces a local variable context that is the active context for the duration of the appended template's composing process. While most variables that the appended template's logic creates stay within this local context, be aware that any set commands may overwrite variables in the template initiating the appending.



Value type
Yes File Yes
Defines the document whose contents are to be appended. The resolved File should be a DOCX document.

Value type
No Boolean No
Defines what will happen to styles in the appended content whose names conflict with styles in the base document. The appending process brings all styles of the appended document into the base document, but two styles with the same name cannot exist in a document and it is quite typical to have a style called "Normal", for example. Which "Normal" would an appended paragraph referring to a style with this name then take? This attribute offers two options to how such conflicts are resolved.

If this attribute's value is true, the conflict is resolved by renaming the conflicting styles of the appended content and bringing them into the base document with their new names. As the appended content's styles continue to exist in the resulting document with new names, all of the content preserves its original formatting. Do note that this causes any numbering sequence to restart as numberings are tied to specific styles.

If this attribute's value is false, the conflict is resolved by not bringing in the appended document's style into the base document. The appended content referring to a conflicting style will then start to refer to the style of the base document with the conflicting name. Any appended content referring to non-conflicting styles will still preserve its original look.

If undefined, the value true is used. 

Value type
No Integer No
This attribute can be used to define the order in which the appended documents appear in the result, should there be more than one appendSection or another kind of command doing a similar job. The smaller the value, the earlier the document appears in the sequence of appendices. If more than one command define the same position, the order in which they appear is defined by the order in which the commands are evaluated.

Note that this attribute does not do anything if this command is in a Flow.

If this attribute is left undefined, the appended document is placed after all appendices that had their position defined. With more than one command that have position undefined, the order is defined by the order in which the commands are evaluated.

Value type
No String Yes
Defines if the header and footer references present in the appended content are removed, therefore forcing the section to inherit the headers and footers of the section preceding it. This will be the case if the resolved value is true.

If not defined, this attribute's value defaults to false, allowing the appended content to keep its original headers and footers.

Value type
This attribute defines what kind of a section break, if any, is placed between the main document content and the appended content.

The possible values are:
  • nextPage
  • evenPage
  • oddPage
  • continuous
  • none
The first four produce a section break of the specified type. The last value "none" is special, resulting in no section break to be created, which then causes the appended content's first section to become a part of the main content's last section.

If left undefined, the value of nextPage is used, producing a standard page break before the appended the content.

Value type
No String Yes
Defines an alias for the document that this command appends. The alias is displayed in Office add-in and is purely an informational value - it does not have any effect on the command's functionality.


The appendSection command may be evaluated up to 20 times within a single evaluation process.