importContent
A Word content command that replaces the contents of its content control with the body contents of another DOCX document. Any Word content commands in that DOCX document will be evaluated before this import process. Besides just the content, this import process also brings in the styles that the content uses in the other document, but see the documentation of the renameConflictingStyles
attribute for one complication in this process.
If this command is used in an inline-level content control that exists within a paragraph, e.g. a content control wrapping a single word within a paragraph, the composed result differs slightly depending on the contents of the other DOCX document. If the imported content consists of a single paragraph, the text of that paragraph is merged into the paragraph the content control is in - much in the same way as how out works. If the imported content consists of more than a single paragraph, the paragraph of the content control is split into two paragraphs and the content from the other document will appear between these paragraphs.
This command has a priority of 25.
importContent
does not work within an evaluation process that is started by another importContent
. In other words, if the DOCX document specified with the data
attribute contains any importDocument
commands, they will not do anything.
Syntax:
importContent(data,renameConflictingStyles)
With required attributes only:
importContent(data)
#1 - data | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | File | Yes |
Defines the document whose contents are brought into the content control. The resolved File value is expected to be a DOCX document. |
#2 - renameConflictingStyles | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | No |
Defines how the styles of the imported contents of the DOCX document defined with
Regardless of the value of this attribute, any styles used in the imported content with non-conflicting names are brought in as is. If undefined, the value of |
Examples
The importContent
command should be relatively easy to use, as you are only required to specify the document to import.
importContent(productTableDoc)
While importContent
could also be used to bring appendices at the end of your document, the command mergeDOCX tends to be more suited for that purpose. The specialty of importContent
is primarily its capability of bringing content into any point of the document.
The second attribute renameConflictingStyles
has a long description, but what it does is relatively simple. Let's say that the imported content contains a paragraph using the style "Normal" that in that document specifies the font as Times New Roman. The document this command is in has the "Normal" style as well, but here the font is set to Calibri. If renameConflictingStyles
is undefined or false
, the imported paragraph will continue to use the "Normal" style and so will appear in the composed document with its font as Calibri. If renameConflictingStyles
is true
, the imported paragraph in the composed document will instead appear to use a style called something like "Normalxe57e7821-a42f-41b3-81d7-f09eb5811ca9", which then defines the paragraph's font as Times New Roman. Leaving the attribute undefined is therefore a good choice if you'd prefer the imported content to blend with existing content.