Output Images

Output image records of rich text fields, image functions fields, and attachments.

*This feature is available in Office File Creator Pro.

 

Overview

Supported File Formats

ExcelWordPDF

 

Supported Patterns

  • Rich Text Area Field

Outputs image data uploaded to rich text fields. If multiple image data exist in the field, the first image is output.

 

  • Image Formula Filed

Outputs image data by formula fields using image functions. URLs must be within the organization's domain. For static resource images, only MIME type "image/xxx" is supported and a ZIP file is not supported. For more information on image functions, see the Salesforce help below.

Use Images in 'Formula' Fields

 

  • Related File Id Field

Outputs image data from the text fields of the record Id of the ContentDocument, ContentVersion, and Attachment objects. The Id length is 15 or 18 characters.

 

  • Attachment File

Outputs the File (ContentDocument), Memo & Attachment (Attachment) attached to the record.

For the details on outputting attachments, see Output Attachment Files (List/Images).

 

Required settings

  • Merge Fields Settings
  • OFC_Template Record Settings (Images of Master Object)
  • OFC_Child Object Option Record Settings (Images of Child Object)

 

 

Merge Fields Settings

Merge fields for images are the same as other fields, with {!Object API Name.Field API Name}, or in the case of a child object, {!Childrelation Name.Field API Name} for child objects.

{!Childrelationship Name.Field API Name}.

e.g. {!Opportunity.Image1__c}

 

 

OFC_Template Record Settings (Images of Master Object)

Open the OFC_Template Object record detail page and enter the field values in the "(Pro) Image" section. Set the margins and size for each file type. The margin and size settings are the same for the main object and child objects.

 

Image Field API Name: Enter the image field API name. If there is more than one, enter them separated by commas. e.g. Image1__c, Image2__c

Excel Size Settings

(Excel) Image Cell Margin (Top) (pt): Enter the top margin of the image in the cell between 0 and 99. If left blank, the default of 3.0 pt is applied. *The unit is points.

(Excel) Image Cell Margin (Bottom) (pt): Enter the bottom margin of the image in the cell between 0 and 99. If left blank, the default of 3.0 pt is applied. *The unit is points.

(Excel) Image Cell Margin (Left) (pt): Enter the left margin of the image in the cell between 0 and 99. If left blank, the default of 3.0 pt is applied. *The unit is points.

*Excel places the image with the upper left corner as the base point.

Word/PDF Size Settings

(Word/PDF) Image Size in Table Cell (%): Enter the size percentage of the image in the table cell. If left blank, the default of 85% is used.

(Word/PDF) Image Default Height (mm): Enter the image height if the row height of the image field is not specified. This is used when the row height of a table is not specified or for images outside of table cells. If left blank, the default of approximately 50 mm is used. *The unit is mm.

 

 

OFC_Child Object Option Record Settings (Images of Child Object)

Open the OFC_Child Object Option record detail page and enter the field values in the "(Pro) Image" section.

Reference: Create OFC_Child Object Option Record

 

Image Field API Name: Enter the image field API name. If there is more than one, enter them separated by commas.

e.g. Image1__c, Image2__c

*The image size setting is entered in the "(Optional) Image" section of the OFC_Template record. The image size setting is common to the master object, child objects, and related files.

 

 

When Lightning Web Security is enabled

When outputting images in Excel or Word, if your organization has Lightning Web Security enabled, output from a custom button. If you output from the Lightning Component button or flow, the file will take significantly longer to output.

 

Lightning Web Security Settings can be found from the Setup > Security > Session Settings > Lightning Web Security section under "Use Lightning Web Security for Lightning web components and Aura components".

*For more information about enabling or disabling Lightning Web Security for your organization, contact your organization's system administrator or Salesforce Help.

 

Use the "Export to File (Custom Button)" button during test output.

 

 

When the error "Apex heap size too large" occurs in Excel/PDF output

If the error message "Apex heap size too large" is displayed when outputting an Excel or Word file, and processing frequently stops, set "(Excel/Word) Image file size limit (mb)" in the OFC_Template record.

 

(Excel/Word) Image File Size Limit (mb): Enter the total image file size to be retrieved at one time in the range of 1MB to 4.28MB. The default is 4.28MB.

 

Memo

  • Normally, the "(Excel/Word) Image File Size Limit (mb)" field is not necessary. Enter it only if the Apex heap size error occurs frequently.
  • The size you set also applies to the output upper limit size for a single file. For example, if you set a file size limit of 3 MB, image files larger than 3 MB will output error images.

 

 

Limitations/Considerations

Considerations

  • If the field value specified for an image field is not image data, a blank field is output.
  • There is no limit to the number of images that can be output, but a large number may take significantly longer to output and may result in errors such as insufficient memory.
  • Whether your data is output correctly depends on the record data and template file, so try in your Sandbox environment.
  • PowerPoint does not support image output of records.
  • URLs in the Image formula must be within the organization's domain.
  • When outputting images of static resources through the Image formula, only MIME type "image/xxx" is supported, and ZIP files are not supported.

 

Excel/Word limitations and considerations

  • When output to Excel or Word, output images with a file size of up to 4.28 MB per image. If the file size exceeds 4.28 MB, the output file displays an error message "This image cannot be displayed" and an error image will be displayed in the output file.
  • When output to Excel or Word, image files are not compressed. For example, if two files of 3 MB image data are output, the output file size will be 6 MB + text data size.
  • When output to Excel, the image is placed in the cell with the upper left corner as the base point. It cannot be centered on the left or right. Size is based on cell height. When the image is aligned with the cell height, a horizontal image may protrude from the cell.
  • When outputting images of rich text items, one organization API call is consumed per image file. For more information about your organization's API calls, contact your system administrator or Salesforce Help.

 

PDF limitations

  • When outputting PDF, use the PDF preview by the custom button. After previewing the PDF, download the PDF from your browser. If the total image size exceeds 2-3 MB or there is a lot of text content, an error will occur when downloading the file or saving it as an attachment to a record.
  • When outputting PDF, up to 30MB total image file size is previewed. The maximum file size per image is 30 MB. If the size exceeds 30 MB, a preview error will occur.

 

 

Reference

Output Attachment Files (List/Images)

Output attached images in Salesforce to documents

Output Images of Rich Text Fields in Salesforce to documents

Output images of Image function fields to documents in Salesforce