Creating the Template
You can create a Microsoft Word email template file as described here.
Viewing or Editing the Template
Once the template is created, click the View button to view the template.
The View button does not work well for editing Microsoft Word docs because of built-in limitations in the way Microsoft Word docs can be opened and edited from the web. Instead, login to your data source and edit the Microsoft Word template file there.
Including an Image in the Template
Your Microsoft Word template can include one or more images.
To include an image:
- Open the template in Microsoft Word
- From the Microsoft Word menu bar select Pictures and select the image you wish to include.
When we export the Microsoft Word template as HTML, we will include the image as an HTML <img> element. The image data is included inline in the src property of the <img> element.
When the template is used as an email Body template, the resulting HTML email body will contain the HTML <img> element. The email client that displays the HTML email body will display the image.
When the template is used as a PDF Attachment template, the HTML to PDF conversion web service will retrieve the image value from the HTML <img> element. The HTML to PDF conversion web service will then include the image in the resulting PDF file.
Including an Image URL in the Template
Your Microsoft Word template can include one or more image URLs. Each image URL must refer to a publicly accessible image.
Template Formatting Tips
The following tips may help you control the appearance of your PDF attachments.
- Under Format > Line spacing, reduce the line spacing to Single if it is currently larger, such as 1.5, Double, etc.
- Under Format > Line spacing, remove Add space before paragraph and Add space after paragraph.
- Under Format > Paragraph styles, change the header formatting to Normal Textrather than Heading 1, Heading 2, etc. Then apply formatting to control the header's font size, color, boldness, etc.
- Remove any excess blank lines.
- Under File > Page setup..., check the page size and margins. For example, consider setting the page size to A4 and reducing the top and bottom margins.
Microsoft Word Template in HTML Format
The Microsoft Word template is read in HTML format when it is retrieved by AppSheet. AppSheet then replaces the template variables in the HTML template with the data values you specify. The resulting HTML document becomes the email body or attachment. For email attachments, we convert the HTML document to PDF format and add the result as the attachment.
In the Word Document, you can specify:
- The Page Orientation as either Landscape or Portrait.
- The Page Width and Page Height.
- The Page Margins for Top, Bottom, Left, and Right.
When we convert the Word Document into HTML, we honor these settings. The HTML body will include properties like the following:
Page Breaks in PDF Attachments
You can include page breaks in the PDF file created from an attachment template file by manually inserting a page break in the Word Document.
- Select the Insert tab.
- Position the cursor where you want the page break to occur.
- From the Microsoft Word Pages menu, select Page Break.
Page Headers, Page Footers, and Page Numbering are Not Supported
Workflow templates do not support automatic page headers, page footers, or page numbering.
If your Word template file contains Word Headers, Word Footers, or Page Numbers they will be ignored.
- Instead, you should include your header contents at the start of your template as normal content. It will appear once at the start of the resulting document.
- You should include your footer contents at the end of your template as normal content. It will appear once at the end of the resulting document.
To handle automatic page headers, page footers, and page numbering, we would need to implement a “page layout engine” that computes the page location of each element being displayed. We would need to be aware of page boundaries, so that we could:
- Insert a footer at the end of each page.
- Insert a bottom margin at the end of each page.
- Insert a top margin at the start of each new page.
- Insert a header at the start of each new page.
- Insert appropriate page numbers.
We do not support any of these features because implementing a “page layout engine” is a lot of work. It is not work that we have done.