Document templates

Prev Next

Exact Forms Plus!

Document template configuration

Document Templates

Document templates are used to lay out how the generated document should look after executing Exact Forms Plus! Document templates must be Word documents, saved with a file extension of .doc or .docx. Any other file extension isn't accepted. Document templates are very similar to native Quickbase Exact Form document templates, minus the Word macro. Exact Forms Plus! uses the same concepts that Exact Forms uses to reference fields from Quickbase tables that you want to include in your final generated document. However, referencing related table data in Exact Forms Plus! templates is different and more powerful than native Exact Forms.

Related table data options (subtable data)

  • Show or hide the table border.

  • Show or hide the table header.

  • Specify the alignment of the table in the document. (Left, Center, Right)

  • Specify the background color of the table header.

  • Specify the font color of the column names in the table header.

  • Control the style and color of all table borders.

  • Control the alignment of each column header. (Left, Center, Right)

  • Alternate the color of each row.

  • Specify which fields from the related table should be included in the document.

  • Control the widths of each column individually.

  • Specify how the data in the table cell should be aligned. (Left, Center, Right)

  • Specify how the data should be formatted in the cell. (Date, Numeric, Currency, Float, Checkbox, Image)

  • Set the font name, size, weight, underline, and italics to be used for each table cell.

  • Specify the column name to use instead of the Quickbase table's field name.

  • Repeat the columns up to 10 times.

  • Group the table data by a specific column.

    • Page break on the grouped value

    • Control font properties of the grouped value

  • Subtotal specific columns in the table.

  • Include an item number column or an automated counter for each line item in your related table.

  • Control the vertical alignment of the data in each column. (Top, Middle, Bottom)

Document Template Setup

Create a new Word document to represent your template. The template must be a Word document, and it must have a .doc or .docx extension. Within this Word document, you can reference fields in your Quickbase table in two ways: either by the field's name or by the field ID number (fid). Surround your field reference with ~, which indicates to Exact Forms Plus that data from Quickbase should be inserted between the tildes.
For example, in a standard letter greeting, you might start it like this:
Dear John Smith, … If the value John Smith is stored in a Quickbase table field called Customer Name with a field ID of 5, your template would look like this:
Dear ~Customer Name~,… or Dear ~5~,…
If you use two fields, First Name (6) and Last Name (7), to store that data, your template would look like this: Dear ~First Name~ ~Last Name~… or Dear ~6~ ~7~

Sample Template

Sample Word document template showing field tags surrounded by tildes

Special Field Types and Functions

There are some special considerations to make when you want to display fields in your document that are defined in your Quickbase table as User, Date, or File attachment (image files).

  • User type fields—if you're displaying a field that's a User type field, we recommend creating a new field in the table as formula text, using the Quickbase function UserToName[myuserfield] to convert it to text. Then reference this new field in your document template.

  • Date fields—date fields display in the standard short date format, 3/22/2009, if you include them as is. If you want your date field displayed in long date format, use the tool's built-in function.
    Ex. If field 26 is defined as a Date field with the value 3/22/2010, here are the results that appear in your generated document based on how you reference the field in your template.

    Template Reference

    Generated Document

    ~26~

    3/22/2010

    ~d#f[26]#MM/dd/yyyy~

    3/22/2010

    ~d#f[26]#MMM-dd-yyyy~

    Mar-22-2010

    ~d#f[26]#MMMM-dd-yyyy~

    March-22-2010

    ~d#f[26]#dddd, dd MMMM yyyy~

    Monday, 22 March 2010

    ~d#f[26]#dddd, MMMM dd, yyyy~

    Monday, March 22, 2010

    ~d#f[26]#MMMM dd~

    March 22

    ~d#f[26]#yyyy MMMM~

    2010 March

To get the current date, replace f[26] with the word today~d#today#MM/dd/yyyy~

Another way to get the current date is to use Microsoft Word itself.

  • Put your cursor in the Word document where you want the date to appear

  • From the Word menu, select Insert, then select Date & Time.

  • In the popup that appears, select the format you want to use, and select the Update automatically checkbox.

    Word Insert Date and Time dialog with the Update automatically checkbox selected

  • Images—if you want to display an image in your document, you must include a special tag in the template. Ex. If field 100 is defined as a file attachment field, or is a formula text field that points to an image file stored in a file attachment field in some other table, you can refer to it like this: ~i:100:400~ The i tells Exact Forms Plus that the field ID 100 is an image, and 400 tells the tool to size the file with a width of 400. You can change the width while testing to get the desired image size in the generated document.

  • Barcodes—if you want to include barcodes in your output documents, learn more about the barcode function of Exact Forms Plus.

  • Numeric percent—when displaying a numeric percent field in the document, the data doesn't display as expected unless you create a new field in your table to format it properly. Set the new field's type to formula text, then set the formula code as follows:

    • ToText([Sales Tax Rate]*100) & "%" where [Sales Tax Rate] is the numeric percent field. Now reference this new formula text field in the template instead of the actual numeric percent field.

    • If you include the numeric percent field without using this concept, it appears in the document with additional zeroes—for example, 8.62500% instead of 8.625%.

  • Currency symbols—used for currency fields where a symbol is overridden in the field's properties.

    • Since the Quickbase XML API doesn't pass back certain symbols properly, use this format in the document template: ~=C|€|f[99]~
      (this currently is only available in the master section of the document template—it doesn't work in subtables)

  • Number to words—if you have a numeric value that you want to display in words instead of numbers, use the following function:

    FormatN(f[field id],$) or FormatN(f[field id],n)—using n instead of $ in the function formats the Numeric field in words without the currency notation.
    Ex. See the chart below. Field 13 is defined as a Numeric Currency field with a value of $7,485.52, and field 14 is defined as Numeric with a value of 6,542.99.
    (€ = alt+0128)

  • Ordinal numbers—a number that tells the position of something in a list, such as 1st, 2nd, 3rd, 4th, or 5th.

Template Reference

Generated Document

Currency - $ and €

~13~

     $7,485.52

~=FormatN(f[13],$)~

Seven Thousand Four Hundred Eighty Five Dollars and Fifty Two Cents

~=FormatN(f[13],$l)~

seven thousand four hundred eighty five dollars and fifty two cents

~=FormatN(f[13],€)~

Seven Thousand Four Hundred Eighty Five Euros and Fifty Two Cents

~=FormatN(f[13],€l)~

seven thousand four hundred eighty five euros and fifty two cents

Number (without Currency Symbol)

~14~

       6,542.99

~=FormatN(f[14],n)~

Six Thousand Five Hundred Forty Two point Ninety Nine

~=FormatN(f[14],nl)~

six thousand five hundred forty two point ninety nine

Ordinal Number (1st or first, s-suffix only, p-position)

~15~

1

~=FormatO(f[15],s)~

1ST

~=FormatO(f[15],sl)~

1st

~=FormatO(f[15],p)~

FIRST

~=FormatO(f[15],pl)~

first

Document Template

Document template showing currency and number formatting tags

Generated Document

Generated document showing formatted currency and number values

Sample templates

See sample document templates for a few working examples.

Create a new Document Template record in Quickbase

When your app was set up, a Document Templates table was created. This table stores all of your templates. Once you've designed your new template as illustrated above, you need to store it in Quickbase so it can be used by Exact Forms Plus!

  1. Navigate to your Document Templates table

  2. Select Add a New Document Template.

This is what the Add screen should look like.

Add Document Template screen in Quickbase

  1. Enter a name for your template

  2. Leave the clist field blank. Use the Exact Forms Plus Configurator utility to populate that field after saving the record.

  3. Select Choose File to upload the template file you created on your local computer.

  4. Select Save.

This is what the screen looks like after you save your new template record.

Document Template record after saving, showing the uploaded template file

  1. Select the Exact Forms Plus Configurator button. This lets you select the master table and the fields from the master table that you want to appear in the output document.

    Exact Forms Plus Configurator showing master table field selection

  1. Once you select the fields you want, select Apply Changes.

  2. Close the Configurator

  3. Refresh your browser

  4. The clist field should now contain a numeric list of the fields you selected.

Document Template record with the clist field populated after using the Configurator