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.

Template Formatting Tips

The following tips may help you control the appearance of your PDF attachments.

  1. Under Format > Line spacing, reduce the line spacing to Single if it is currently larger, such as 1.5, Double, etc.
  2. Under Format > Line spacing, remove Add space before paragraph and Add space after paragraph.
  3. 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.
  4. Remove any excess blank lines.
  5. 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.

Page Layout

In the Word Document, you can specify:

  1. The Page Orientation as either Landscape or Portrait.
  2. The Page Width and Page Height.
  3. 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:

body {
    margin-top: 72pt;
    margin-bottom: 72pt;
    margin-left: 62pt;
    margin-right: 62pt;
    max-height: 612pt;
    max-width: 792pt;
}

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.

  1. Select the Insert tab.
  2. Position the cursor where you want the page break to occur.
  3. 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. 

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.

Did this answer your question?