BP Forms Template Design

BP Forms Tech Tip: Technical Design Considerations when Building Form Templates in OpenOffice

Building of form templates involves two basic steps: (1) design of form template using word processing techniques combined with graphical elements and (2) creation and implementation of tags (placeholders) to facilitate printing of dynamic data elements.

This article will discuss design considerations relevant to constructing a form template similar to the STATEMENT form illustrated above.

Before you begin designing a form, it is helpful to have a printed example of the actual form generated by your legacy print system to use as a reference model. You will use standard word processing techniques to create most elements of the form. For example, you will select a specific text font, style and size (or multiple font types) to use throughout the form. You might also manipulate paragraph formatting, such as line and paragraph spacing. Many forms display tabular data, so you will decide where you would like to print of lines an/or grids. Finally, you will have the option to incorporate of pictures, images, maps, logos, or other graphic elements to improve the look of your form.

The following sections discuss a number of static design elements that you can use within your form. Static elements look exactly as they appear in the template when final document is produced.

Tables

Tables are often an excellent design element to utilize within forms as they provide an elegant way to organize form data into columns and rows.

  • Choose whether to add a grid or border to your table.
  • Create custom table headings with special features and formatting (e.g., background color, header repeats on subsequent pages, etc.).
  • Change line and paragraph spacing to accurately model the original form.

Headers and footers

Headers and footers are appropriate to use for content that needs to be repeated at the top or bottom of each page. Company logos and table headers are excellent examples of content that should be placed in headers. Open Office allows you to utilize different headers on different pages (i.e., first page, last page, odd pages, even pages, etc.) Look for Open Office tutorials on the web to see examples of how to incorporate headers into your form templates.

Tab Stops

When your data needs to flow over multiple form pages, you can format the columnar data using tab stops, and then embed tab characters (odt/tab format) into the tag data (see the BP Forms API documentation for how to create repeating data using odt tabbed tables). By formatting the data using this method, Open Office will automatically handle the pagination and render the headers and footers appropriately to create the final document. Alternatively, tables can be used to model repeating data.

Frames

Frames are useful when you wish to have data overlaying a section of the document and do not wish to have that data affect other parts of the document. 

External Images

The Open Office .odt format allows the template designer to embed images into the document or to place an external reference to an image within the document. The external reference technique is preferred in most cases because, since the image is not stored inside of the document, the documents are much smaller. However, for documents to be delivered to customers, make sure that the URL to the image is accessible outside of your firewall; otherwise, the user will see a “broken image” placeholder instead of your desired image. External images can be used for logos, pictures, and even signatures (to marry a signature to the document). See the Open Office documentation for more information about images and externally linked images.

Dissection of a form template

Following is an example of how form elements can be placed within the template.

The blue area represents the header that repeats at the top of each page. In the example above, we used the header to display the logo, masthead, heading “STATEMENT,” date, customer name, customer ID, page number, and we added a table to hold the column headers for the data that will display in the yellow document body.

The yellow area is the normal document body. Multi-page text that prints within this area will flow from page to page and not repeat on subsequent pages. In this example, tab stops were used to define the column locations and justification. The data fed into the form was tab-delimited so the data flows cleanly onto the form template, with the columnar data presented appropriately with left-, centered- or right-justified alignment.

The green area represents the footer area that will repeat at the bottom of each page. In this example, the footer contains a table followed by a normal document (non-tabled) area for footnotes, etc.

The pink area is an Open Office frame containing a block of text that the customer required by printed on every page. The frame is anchored to the upper left corner of the page and is technically outside of the normal document area. Text orientation within the frame was changed to "vertical" instead of "horizontal."

Using template tags to pass data to a form document

BP Form templates contain dynamic elements as well as the static element types discussed above. Dynamic elements change depending on the data being passed to the document for printing. 

Consider how tags are utilized in the following customer statement form template.

This section will explain how the above form template utilizes specific tags to present dynamic data. But first, let's define tags.

A Primer on Tags

Before you start using tags in your form template, it is important to understand the terms “tag” and “value.” Tags are simply short names that are associated with dynamic text. They are considered "placeholders." If you are familiar with the operation of mail merge functions within word processing products, you already understand tags.

Using mail merge as an example, you might create a Microsoft Word document that looks like the following:

The template contains the following tags customer, product and purch_date;. In mail merge, these words are generally column names from a spreadsheet or database. An example of the data table containing the mail merge data might look like the following:

When the mail merge is started, the program reads through the rows in the above spreadsheet table. The Word mail merge document when linked with the Excel data source (see above), will generate three letters, including the following:

Make sure your tags are unique

Similar to how the mail merge feature of Microsoft Word uses tags, surrounded by chevron characters (< and >), you will create unique tags in your BP Form templates. You can designate your tags using any type of character; however, take care to ensure that those characters will not inadvertently clash with words that may be used as static elements within your template. For example, if you use only text characters to create a tag (e.g., use only the phrase “customer” as a tag), and then create a template that includes the paragraph: “We will be offering a 10% discount to all of our customers,” then the printed paragraph might read something like: “We will be offering a 10% discount to all of our Tom Woods.” This is because the word "customers" was actually detected as a tag, so the letters "customer" were replaced with dynamic data.

In order to avoid this situation, use a tag naming convention that prevents these types of collisions. For example, use the tag “%customer%,” instead of “customer,” because the chance of the specific term “%customer%” occurring in static text is very unlikely. It is always a good practice to end the tag with a special character as this practice prevents possible collisions between ambiguous tags. Consider the following.

The following tag names are defined:

Tag Name Value
%customer Taggart Transcontinental
customer_address 123 Taggart Avenue

 

The form template includes the following tag references to dynamic data:

Dear %customer,

We see your address is %customer_address.

And the form is generated as follows:

Dear Taggart Transcontinental,

We see your address is Taggart Transcontinental_address.

In this scenario, the rendering engine will reference the first tag in the table and replace all instances of “%customer” with “Taggart Transcontinental.” Unfortunately, this causes the second tag “%customer_address” to be altered in the final document, because the "%customer" portion of the tag is replaced by the value “Taggart Transcontinental.” The second tag subsequently is converted to “Taggart Transcontinental_address,” which is simply a string of text and no longer represents a tag. So, when the rendering engine attempts to process the second tag name in the table, it looks for “%customer_address” in the template; however, this tag no longer exists because it was changed to “Taggart Transcontinental_address” during the referencing of the first tag.

Consider what happens when you utilized the "%" character to delineate the beginning and end of the tag (i.e., %customer%). Use of a closing tag character, in addition to the leading tag character, prevents ambiguity and results in the document being rendered as expected:

Dear Taggart Transcontinental,

We see your address is 123 Taggart Avenue.

The percent sign (%) is a character that is often used in UNIX scripts, so this is a recommended character for use in BP Forms template tags; however, any character that allows the tag to be unique and non-ambiguous may be used.

BP Forms does not place restrictions on the characters used in a tag; however, we make the following recommendations:

  • Do not include control characters. Do not include lf (linefeed), cr (carriage return) or tab.
  • Use 7-bit characters (lower than ASCII 128).
  • Do not include UNIX demon characters.

Detailed explanation of a form template example

Header section of sample statement form template

The elements of this header include the following:

IWI Logo

jpg image. Static element.

“Please Send all...”

Simple text. Static element

STATEMENT

Simple text. Static element.

%s_stmt_date%

Tag (placeholder). Dynamic element. When the document is rendered, this tag will be replaced with the actual statement date.

Page | 1

“Page |” is simple text, but the number “1” is an OpenOffice field that displays the current page number. Static element.

%c_name%

Tag (placeholder). Dynamic element.&nbsp;When the document is rendered, this tag will be replaced with the customer name.

Table headings (Reference, Customer Ref, Debit, etc.)

Simple one-row, eight-column table; static element. This element provides the column headers for the body of the document where the actual statement detail will appear. Since this element is in the header, it will repeat at the top of each page.

 

It is relevant to note that this form template example utilizes two tables in the header: one that contains the logo, masthead, and page number, and a second that contains the column headers for the detail lines of the statement. This template design illustrates how a combination of word processing elements and tags can allow presentation of a concise and easy-to-define header structure using conventional word processing techniques.

Body section of sample statement form template

The elements of the document body include the following:

<table style="width: 700px;" border="0" cellpadding="5">
<tbody>
<tr style="background-color: #f2f2f2;">
<td><strong>Previous Total Due</strong></td>
<td>Text label. Static element. Note that this element is one tab position from the left margin. This was achieved by simply pressing the tab key to move the cursor to this position.</td>
</tr>
<tr>
<td><strong>%s_prev_bal%</strong></td>
<td>Tag (placeholder). Dynamic element. This tag indicates where the previous balance should be inserted. Note that this element is positioned several tab positions to the right of the left margin. By using tab stops, the previous balance value will be inserted into the final document according to the specific tab position, which happens to be under the “Credits” column heading.</td>
</tr>
<tr style="background-color: #f2f2f2;">
<td><strong>Prev Bal</strong></td>
<td>
<p>Text label. Static element.</p>
</td>
</tr>
<tr>
<td><strong>%s_prev_bal%</strong></td>
<td>Tag (placeholder). Dynamic element. This element is a repeat of the %s_prev_bal% element that appears in the rightmost tab position. The s_prev_balance value is inserted into the final document under the "Amount" column heading, on part of the document that becomes a perforated, tear-off receipt.</td>
</tr>
</tbody>
</table>

Footer section of sample statement form template

The elements of the document footer include the following:

<table style="width: 700px;" border="0" cellpadding="5">
<tbody>
<tr style="background-color: #f2f2f2;">
<td><strong>%s_age_lbl_1%</strong></td>
<td>Tag (placeholder). Dynamic element. This element defines where the label for this column should be inserted, and prints “0-30” as the column header. For this STATEMENT form example, the business application statement generation program examines the customer records. If the customer has a balance in a aging bucket (0-30, 31-60, 61-90, or 90 days over), the statement prints a label on that aging box. &nbsp;So, if the customer has a aged balance of 0-30 days but not 31-60 days, then only the box label for 0-30 will appear and the other boxes (2, 3 and 4) labels will be blank (along with the balance below).&nbsp;</td>
</tr>
<tr>
<td><strong>New Balance</strong></td>
<td>Simple text. Static element.</td>
</tr>
<tr style="background-color: #f2f2f2;">
<td><strong>%s_cum%</strong></td>
<td>Tag (placeholder) for the cumulative balance. Dynamic element.</td>
</tr>
<tr>
<td><strong>All NSF...</strong></td>
<td>Simple text. Static element.</td>
</tr>
<tr style="background-color: #f2f2f2;">
<td><strong>Codes...</strong></td>
<td>Simple text. Static element.</td>
</tr>
<tr>
<td><strong>PLEASE SUBMIT...</strong></td>
<td>Simple text. Static element.</td>
</tr>
</tbody>
</table>

Note that the footer section contains a table with two rows and six columns. The text appearing below the table was created with simple text (no table) and tab stops.

Frame section of sample statement form template

The area printed on the left side of the sample statement form contains two Open Office frames with text inserted.It is used as a reference tab to help those who stuff envelopes detect the beginning of the next statement, with reference information to easily match to a mailing label. This element was defined in Open Office by (1) creating a new frame, (2) anchoring it to the page (not the paragraph), and then (3) dragging it to the left page border. In addition, the frame properties were changed to allow vertical orientation of the text.