Articles in this section

How to set the image header of a document

This article explains what the image header setting is and provide examples of how it can be used with the binding syntax in smart templates.

  Prerequisites

  • Library and at least one Dynamics module enabled.
  • Templafy Desktop and Office VSTO add-in installed.
  • Space owner access to the Templafy tenant.

What is the image header setting?

The Image Header is used for images in the header of a Word document. It is typically used for a logo on the company letterhead and can be set dynamically using the binding syntax.

  Important

The Image Header setting is only available in Word and is only supported with templates that are stored in the Documents Library.

How to set the image header in a smart document

When building the template settings and properties, the Image Header can be used to set the document header for the smart template, following the steps below:

  1. In Template Designer, open the Advanced tab.
  2. Click + Add property.
  3. In the Type field select Image Header.
  4. The following fields are available:
    advancedtabimageheader.png
    • Image: The binding to the image, e.g. {{UserProfile.Office.Logo.Image}}.
    • Shape Name: The name of the image header, e.g. 'MyLogo'. You can create multiple image headers using a unique name for each image header.
    • Width: The width of the image. You can use a (dynamic) binding like {{UserProfile.Office.Logo.Width}} if you want to retrieve the value from a data source, but you can also enter a (static) value in centimeters like '2.5 cm' (without quotes), like in the field Left Offset in the image above).

        Important

      • Use a decimal as separator, a comma is not supported.
      • Use 'cm' as unit of measure, other values like 'mm' are not supported.
    • Height: The height of the image. You can use a (dynamic) binding like {{UserProfile.Office.Logo.Width}} if you want to retrieve the value from a data source, but you can also enter a (static) value in centimeters like '2.5 cm' (without quotes).

        Important

      If you only set Width or Height then the image is displayed in the set width or height, maintaining the aspect ratio.

    • Named Sections: The section(s) in which the image will be shown. These values can be used:
      • {{NamedSections.All}}: Image is shown in all sections.
      • {{NamedSections.First}}: Image is only shown in section 1.
      • {{NamedSections.Last}}: Image is only shown in the last section.

          Important

        • Named Sections only works correctly when in all sections (after section 1) in the header the option Link to Previous (Same as Previous) is disabled.
        • NamedSections.First does not work when in Word the option Different First Page is enabled.
        • Do not use Named Sections, Numbered Sections (List) and Named Pages at the same time as this might cause unexpected results.
    • Named Pages: The page(s) on which the image will be shown. These values can be used:
      • {{NamedPages.Default}}: Shows the image from page 2 onward.
      • {{NamedPages.First}}: Shows the image on the first page.
      • {{NamedPages.Odd}}: Shows the image on odd pages.
      • {{NamedPages.Even}}: Shows the image on even pages.
      • {{NamedPages.All}}: Shows the image on all pages.

          Important

        • NamedPages.First and NamedPages.Default only work when in Word the option Different First Page is enabled.
        • Do not use Named Pages, Named Sections and Numbered Sections (List) at the same time as this might cause unexpected results.
    • Numbered Sections (List): Shows the image in specific sections. For example if you want to show the image in sections 2 and 4, click Add value twice and enter '2' and '4' (without quotes):
      imageheadernumberedsections.png

        Important

      Do not use Numbered Sections (List), Named Sections and Named Pages at the same time as this might cause unexpected results.

    • Left Offset: Show the image x centimeters from the left side of the page (unless the Horizontal Relative Position is set). You can enter a (static) value in centimeters like '2.5 cm' (without quotes) or use a (dynamic) binding like {{UserProfile.Office.Logo.LeftOffset}} if you want to retrieve the value from a data source.

        Important

      • Use a decimal as separator, a comma is not supported.
      • Use 'cm' as unit of measure, other values like 'mm' are not supported.
      • Left Offset only works correctly when Top Offset is also set.
    • Horizontal Relative Position:
      • {{HorizontalRelativePosition.Margin}}: Position of the image to the right from the margin.
      • {{HorizontalRelativePosition.Page}}: Position of the image from the left side of the page.
      • {{HorizontalRelativePosition.Column}}: Position of the image to the right of the column.
      • {{HorizontalRelativePosition.Character}}: Position of the image to the right of the character.
      • {{HorizontalRelativePosition.LeftMargin}}: Position of the image to the right from the left margin.
      • {{HorizontalRelativePosition.RightMargin}}: Position of the image to the right from the right margin.
      • {{HorizontalRelativePosition.InsideMargin}}: Position of the image to the right from the inside margin.
      • {{HorizontalRelativePosition.OutsideMargin}}: Position of the image to the right from the outside margin.

          Important

        • If the Left Offset is set, then the Horizontal Relative Position takes this into account (so the actual position is the Horizontal Relative Position + Left Offset).
        • You can use Horizontal Relative Position and Horizontal Alignment settings combined, but this might cause unexpected results. In general either use Horizontal Relative Position or Horizontal Alignment.
    • Horizontal Alignment:
      • {{HorizontalAlignment.Left}}: Show the image horizontally to the left of the page.
      • {{HorizontalAlignment.Right}}: Show the image horizontally to the right of the page.
      • {{HorizontalAlignment.Center}}: Show the image horizontally in the center of the page.
      • {{HorizontalAlignment.Inside}}: Show the image horizontally to the right of the inside margin.
      • {{HorizontalAlignment.Outside}}: Show the image horizontally to the right of the outside margin.

          Important

        You can use Horizontal Alignment and Horizontal Relative Position settings combined, but this might cause unexpected results. In general either use Horizontal Alignment or Horizontal Relative Position.

    • Top Offset: Show the image x centimeters from the top of the page (unless the Vertical Relative Position is set). You can enter a (static) value in centimeters like '2.5 cm' (without quotes) or use a (dynamic) binding like {{UserProfile.Office.Logo.TopOffset}}if you want to retrieve the value from a data source.

        Important

      • Use a decimal as separator, a comma is not supported.
      • Use 'cm' as unit of measure, other values like 'mm' are not supported.
      • Top Offset only works correctly when Left Offset is also set.
    • Vertical Relative Position:
      • {{VerticalRelativePosition.Margin}}: Position of the image below the margin.
      • {{VerticalRelativePosition.Page}}: Position of the image from the top of the page.
      • {{VerticalRelativePosition.Paragraph}}: Position of the image below the paragraph.
      • {{VerticalRelativePosition.Line}}: Position of the image below the line.
      • {{VerticalRelativePosition.TopMargin}}: Position of the image below the top margin.
      • {{VerticalRelativePosition.BottomMargin}}: Position of the image below the bottom margin.
      • {{VerticalRelativePosition.InsideMargin}}: Position of the image below the inside margin.
      • {{VerticalRelativePosition.OutsideMargin}}: Position of the image below the outside margin.

          Important

        • If the Top Offset is set, then the Vertical Relative Position takes this into account (so the actual position is the Vertical Relative Position + Top Offset).
        • You can use Vertical Relative Position and Vertical Alignment settings combined, but this might cause unexpected results. In general either use Vertical Relative Position or Vertical Alignment.
    • Vertical Alignment:
      • {{VerticalAlignment.Top}}: Show the image vertically at the top of the page.
      • {{VerticalAlignment.Bottom}}: Show the image vertically at the bottom of the page.
      • {{VerticalAlignment.Center}}: Show the image vertically in the center of the page.
      • {{VerticalAlignment.Inside}}: Show the image vertically inside the page.
      • {{VerticalAlignment.Outside}}: Show the image vertically outside the page.

          Important

        • You can use Vertical Alignment and Vertical Relative Position settings combined, but this might cause unexpected results. In general either use Vertical Alignment or Vertical Relative Position.
    • Image Text Wrapping:
      • {{ImageTextWrapping.InFrontOfText}}: If the header contains text then the image is shown in front of the text.
      • {{ImageTextWrapping.BehindText}}: If the header contains text then the image is shown behind the text.
    • Rotation:
      • {{Rotation.Clockwise90Degrees}}: Image is rotated 90 degrees to the right.
      • {{Rotation.Clockwise180Degrees}}: Image is rotated 180 degrees.
      • {{Rotation.Counterclockwise90Degrees}}: Image is rotated 90 degrees to the left.
    • Color: Specifies the color transformation applied to the image:
      • {{ColorType.Automatic}}: Default color transformation (image is shown in default colors).
      • {{ColorType.Grayscale}}: Grayscale transformation (image is shown in grayscale).
      • {{ColorType.BlackWhite}}: Black and white transformation (image is shown in black and white).
      • {{ColorType.Mixed}}: Mixed transformation.
      • {{ColorType.Watermark}}: Watermark transformation.
  5. Optional: set the additional setting Disable Updates. If this is enabled, no changes will be applied when the document content updater is used. By default it's disabled, allowing updates.
  6. Click Add to document.

  Note

In the template no field is added. If you want to know if a template contains an Image Header, select the Advanced tab, and check if an Image Header field is configured.

Image header examples

Example 1

To show/hide an image in general you can use a Visibility binding to achieve this, but the Image Header does not provide a Visibility field. However following the steps below, using the IfElse() function, you have the option to show/hide an Image Header image, using a Checkbox.

In step 4 above (see image) the binding {{UserProfile.Office.Logo.Image}} is used. The image is retrieved from the LogoInsertion data source. Now the first step is to add a new schema field (column) to the data source, e.g. 'NoImage' (you can use any name). The new schema field must be of type Image! In the data source leave the column empty. The result looks like this:

datasourcelogoinsertion.png

Now in the Image field (of the Image Header) replace the binding {{UserProfile.Office.Logo.Image}} with this binding: {{IfElse(Form.ShowLogo, UserProfile.Office.Logo.Image, UserProfile.Office.Logo.NoImage)}}.

  • If the checkbox is checked, then the image is retrieved from the Image column.
  • If the checkbox is unchecked the image would be retrieved from the NoImage column, but since this column does not contain any images, nothing is returned!
Binding {{IfElse(Form.ShowLogo, UserProfile.Office.Logo.Image, UserProfile.Office.Logo.NoImage)}}
Input Form.ShowLogo = "☑" Form.ShowLogo = "☐"
Output Logo is inserted Logo is not inserted

Example 2

The same configuration as used in example 1, but in this example the image is shown/hidden depending on the value of a dropdown form field.

  • If the 'Show logo' answer is 'Yes' then insert the image located in the Image column of the data source.
  • If the 'Show logo' answer is not 'Yes' then insert the image located in the NoImage column of the data source, which results in no image being inserted, as this column is empty.
Binding {{IfElse(Equals(Form.ShowLogo.Name, "Yes"), UserProfile.Office.Logo.Image, UserProfile.Office.Logo.NoImage)}}
Input Form.ShowLogo.Name= "Yes" Form.ShowLogo.Name= "No"
Output Logo is inserted Logo is not inserted
email signature Salesforce best practices elementsmetadata tech_role
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.