out
A Word content command that replaces the contents of its content control with text. This command should be placed into a content control already containing text, such as the Rich text content control.
The resolved value of the first attribute value
defines the text. It may be an HTML value, a Map, a Data item, a File, a String, or any other kind of value that then gets converted into a String.
If the value is an HTML value, the HTML tags within the value are converted into equivalent DOCX content structures, such as paragraphs and bolded font, and brought into the content control. However, please note that the support for different HTML tags is very limited as this feature was designed to render values of rich-text fields in Salesforce in 2013 and so only interprets the tags the field's value editor back then produced.
If the value is a Map or a Data item, the text already within the host content control is used as a key to get a value from the Map or Data item. The value received with the key is then optionally parsed and formatted, and converted into a String if it isn't one already. The resulting String is brought into the content control.
If the value is a File and its file type is either JSON or text, the contents of the File are brought into the content control. For a File of any other type, a general descriptor of the File is presented.
If the value is a String, that String is simply set as the text content of the content control.
If the value is of any other type, its text representation is set as the text content of the host element.
This command has a priority of 15.
Syntax:
out(value,format,parser,color)
With required attributes only:
out(value)
Attributes
#1 - value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | Boolean | Yes |
Defines the text content brought into the content control. The resolved value may be of any kind, with special handling for certain value types as described in the documentation above. |
#2 - format | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | No |
Specifies a Format that takes the value to output and formats it into a String according to its formatting rules. This attribute doesn't have any effect if the output value is an HTML value or a File. The resolved String is expected to be the name of a Format defined earlier in the logic. |
#3 - parser | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | No |
If the resolved value of this attribute is the name of a Parser, the value to output is first converted into a String (if it isn't one already) and then parsed into another type of value by the Parser. This attribute doesn't have any effect if the output value is an HTML value or a File. If both If undefined or if the named Parser cannot be found, the value retains its original type. |
#4 - color | ||
---|---|---|
Required | Value type | EL-evaluated |
No | String | Yes |
Defines a new color for the text brought into the content control. If not defined, the color of the content control's text is not changed. |
Examples
In its basic use, out
only requires its first attribute value
to be defined.
out(greeting)
out(opportunity.Amount)
The second attribute format
typically comes useful with Number and Currency values. The third attribute parser
is generally of limited use, primarily allowing String values representing numbers to be affected by Number formatters.
out(opportunity.Amount,amountFormatter)
out(numberlikeString,fancyNumberFormat,numberParser)
Use the fourth attribute color
to dynamically alter the text color.
out(greeting,,,coolColor)
Using inline expressions
A shortcut alternative to using Content Control Properties and out
content command is using inline expression straight inside the document text. Instead of creating a placeholder text and adding a content control without command to it:
we can also type the inline expression straight in the text in the form of ${var.fieldName}
Inline expressions can only be used when the out
content command only needs the required attribute (out(value)
).