Customize content using Microsoft Word templates as described in the following sections:
See also Using templates in a bot.
Customizing content using a Microsoft Word template
If your default data source is Box, Dropbox, Microsoft Office 365, or Microsoft OneDrive (in other words, not Google Drive), create a Microsoft Word or PDF template, as described in Creating a template.
If your default data source is Google Drive, follow the steps described in Creating a Microsoft Word template on Google Drive.
Manually create a Microsoft Word template in your cloud file system and use it, as described in Using an existing email template.
For information about customizing the template, see Customizing content using templates and the tips provided below.
Creating a Microsoft Word template on Google Drive
By default, when your default data source is Google, the Create button will create a Google Docs template file on Google Drive.
To create a Microsoft Word template on Google Drive:
Create a template.
A Google Docs template is created on Google Drive, by default.
Click View to view the template.
From the Google Docs File menu select Download > Microsoft Word (.docx).
This will convert the Google Docs template to a Microsoft Word template and download it to your browser.
Upload the Microsoft Word template to Google Drive.
For consistency, upload the Microsoft Word template to the same folder where the newly created Google Docs template resides. Typically this is the Content folder beneath the Default app folder. The Default app folder location is set using the Info > Properties > App Properties tab.
In the AppSheet Editor, click the Browse button and navigate to the Microsoft Word document you just uploaded to Google Drive.
Delete the Google Docs template file from Google Drive, if desired.
Viewing the template
After creating or selecting the template, click View adjacent to the template property to view the template.
Note: We do not recommend that you edit the template in this view due to the built-in limitations in the way Microsoft Docs files can be opened and edited from the web.
Editing the template
To edit the template, open the Microsoft Word template from your data source.
How AppSheet processes a Microsoft Word template
AppSheet reads the Microsoft Word template in HTML format and replaces the template variables and expressions in the HTML template with the data values. The resulting HTML document becomes the email body or attachment. AppSheet converts the HTML document to PDF format before adding it as an attachment.
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.
Position the cursor where you want to insert the image.
From the Microsoft Word menu bar select Pictures and select the image you wish to include.
When AppSheet exports the Microsoft Word template as HTML, it will include the image as an HTML
<img> element. The image data is included inline in the
src property of the
When the template is used as an email body template, the resulting HTML email body contains the HTML
<img> element. The email client that displays the HTML email body displays the image.
When the template is used as a PDF attachment template, the HTML-to-PDF conversion web service retrieves the image value from the HTML
<img> element and includes 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.
Tips for formatting the template
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, and so on.
Under Format > Line spacing, remove Add space before paragraph and Add space after paragraph.
Under Format > Paragraph styles, change the header formatting to Normal Text rather than Heading 1, Heading 2, and so on. Then apply formatting to control the header's font size, color, boldness, and so on.
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.
Customizing the page layout
In the Word Document, you can specify the following:
Page Orientation as either Landscape or Portrait.
Page Width and Page Height.
Page Margins for Top, Bottom, Left, and Right.
When AppSheet converts the Word Document into HTML, it honors these settings. The HTML body includes properties similar to the following:
Adding 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 Microsoft Word template.
Select the Insert tab.
Position the cursor where you want the page break to occur.
From the Microsoft Word Pages menu, select Page Break.
Unsupported features: Page headers, page footers, or page numbering
Email 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.
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.