image
A Word content command replaces a placeholder image within its host content control with another image. This command should be placed into a content control containing an image.
A placeholder image can be any raster image that will be replaced with a new image. Placeholder image size will be used for the new image. For additional info and options, please see also lockHeight and lockWidth attributes.
This command has a priority of 15.
Syntax:
image(value,lockHeight,lockWidth)
With required attributes only:
image(value)
Attributes
#1 - value | ||
---|---|---|
Required | Value type | EL-evaluated |
Yes | File | Yes |
Defines the image that will replace the placeholder within the host content control. The resolved value is expected to be a File that is an image of some kind. |
#2 - lockHeight | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines if the image is to be displayed with the height of the placeholder image instead of its natural height. If the resolved value is |
#3 - lockWidth | ||
---|---|---|
Required | Value type | EL-evaluated |
No | Boolean | Yes |
Defines if the image is to be displayed with the width of the placeholder image instead of its natural width. If the resolved value is |
Examples
The common way to get an image for this command is to use the load command to retrieve an image file from Salesforce. Then just use the variable produced by load
as the value for the value
attribute.
In the logic:
<load var="sampleImage" recordId="${imgId}">
In the content control title:
image(sampleImage)
Make use of the second and third attributes lockHeight
and lockWidth
to have control over the document layout, as without either of those defined the image will appear in the result at whatever its original size is, which can cause the layout to range quite a bit if the image's size differs notably from that of the placeholder's. This can be very useful when the image
is used within the row of a dynamic table (created with the table command), as then all the images in the produced table rows would be of the same size. The same holds if using an image
within repeat as well.
The following example would make it so that all the images in the "images" Collection variable would appear in the composed document at the size of the placeholder image, regardless of their original size.
repeat(images,img) image(img,true,true)