mergeDOCX
Brings the content of a DOCX document at the end of another DOCX document's content. The result of this merging process will be the document defined with the base attribute, with the content of the document defined with the appendix attribute placed after the existing content. Styles, headers and footers used in the appendix document's content are part of the merging process as well, but how exactly they are handled is configured with the attributes renameConflictingStyles
and inheritHeadersFooters
.
Attributes
var | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | String | No |
Defines the name of the variable that will hold the combined document File as its value. |
base | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | File | Yes |
Defines the document that will be used as the base of the merging process. The resolved File value is expected to be a DOCX document. |
appendix | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | File | Yes |
Defines the document whose content will be added to the end of the base document. The resolved File value is expected to be a DOCX document. |
name | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines the name given to the merged document File. If undefined, the merged document will inherit the name of the base document. |
renameConflictingStyles | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | No |
Defines how the styles of the contents of the DOCX document defined with
Regardless of the value of this attribute, any styles used in the appendix content with non-conflicting names are brought in as is. If undefined, the value of |
inheritHeadersFooters | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines whether the appendix content will use the headers and footers of the base document, or its own from the appendix document.
If the If undefined and the resolved value of |
sectionBreak | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines what kind of a section break, if any, is inserted between the base document's content and the appendix content. The resolved value should be one of the following Strings:
If undefined or if the resolved value is not one of those specified, the value of "nextPage" is used. |
Examples
In its simplest form, mergeDOCX
only requires the documents to be specified. The appendix content will start on a new page, follow the styles of base document, but have its original headers and footers.
<mergeDOCX var="merged" base="${baseDocx}" appendix="${otherDocx}">
If you'd like the appendix content to follow the existing content without any kind of page break, set sectionBreak
to either "continuous" or "none".
<mergeDOCX var="merged" base="${composed}" appendix="${someMoreText}" sectionBreak="continuous">
The renameConflictingStyles
attribute has a long description, but what it does is actually relatively simple. Let's say that the appendix content contains a paragraph using the style "Normal" that in that document specifies the font as Times New Roman. The base document has the "Normal" style as well, but here the font is set to Calibri. If renameConflictingStyles
is undefined or false
, the appendix content will continue to use the "Normal" style - now that of the base document's - and so the appendix paragraph will appear in the merged document with its font as Calibri. If renameConflictingStyles
is true
, the appendix content will instead use the appendix document's "Normal" - renamed into something like "Normalxe57e7821-a42f-41b3-81d7-f09eb5811ca9" - and the paragraph's font will remain as Times New Roman. Leaving the attribute undefined is therefore a good choice if you'd prefer the appendix content to blend with the base content.