See this article about recommended version of Open Office and Libre Office for creation and Editing of templates Recommended Office Versions |
Header
Headers are appropriate to use for content you wish to have repeated at the top of each page. Company logos, table headers, etc are good examples of where headers are appropriate. OpenOffice allows for different headers on different pages (i.e., first page, last page, odd pages, even pages, etc) See The OpenOffice tutorials and examples for a detailed explanation of OpenOffice styles and how to properly use headers with Blue Prairie Forms.
Footers
Headers and like footers but are used when you wish to have content repeated at the bottom of each page. This can be used, for example, when you wish to have document details such as totals repeated at the bottom of each page. OpenOffice/LibreOffice also allow for the modeling of styles so that a footer may only appear on the last page or the first page of a document.
The easiest way to have totals appear only on the last page of the document is to simply place the totals within the document body (rather than in the footer), then it will naturally appear on the last page. This is often simpler then modeling different firstpage/lastpage styles.
Tables
Tables are a good design element to use. They provide an elegant way to organizing information into columns and rows. Using Blue Prairie Forms repeating tag feature, tables can be used to organize repeating data within your forms.
Constraining data within a cell
By default, OpenOffice table cells will wrap when the text within them exceeds the width capacity of the cell. In some situations, this is desirable but in others, such as situations where you wish to have a uniform grid of rows all with a uniform height, it can be problematic. There are two basic approaches to dealing with this situation:
- You can ‘trim’ the value to go into the cell on the host side before it is passed into the document. While this is easy to do, remember that it violates the rule of keeping the formatting of the data separated from the data. We prefer the second approach which is template based.
- You can use the capabilities of OpenOffice to constrain the data even if it would normally cause the cell to wrap.
Templating Technique
The following example uses OpenOffice’s constrained row height feature to prevent a cell from increasing in height when cell contents exceed the space allocated to the cell. To test the technique in a fresh OpenOffice document, follow these directions:
- Open a new OpenOffice document
- Chose Table > Insert > Table from the menu
- Choose setting like this (make sure you have at least two rows)
- This will result in a table resembling this to be inserted into the document
- Now, place the cursor just to the left of the row we wish to constrain until the cursor turns into a bold right arrow and then right-click. A pop-up menu will appear. Choose “Row > Height” from the pop-up menu and the following dialog box will appear:
- Make sure the “Fit to size” box is unchecked and that there is a reasonable height set for the row (.01 is too small and will just display a line across the screen because it is a really short cell.) .27 is usually a reasonable height for a cell.
Now, go into a cell and type as much text as you wish. It will not wrap and a red arrow will appear when the right boundary of the cell is exceeded but the cell will not increase in height. Here is an example:
Example shown just before the upper-left cell’s width is overrun
Example shown just after the upper-left cell’s width is overrun (note the red arrow)
The printed output will not contain the red arrow and will show the left-most viewable area of the cell when printed (this is what we want).
Using Frames to Span Columns in a Table
Sometimes it is desirable to have data flow from one column and spill over into columns to the right. You’ll often find legacy print programs that use this technique to print comments or other documentation interspersed within the normal columnar repeating data.
Because you may model the table columns to be constrained in width, data inserted into the column using a placeholder tag could only be truncated to the width of the column or wrap based on the width of the column. To override this standard behavior of a table column, you can use OpenOffice / Libre Office Frames to allow for spanning of columns so that data from one column can extend into adjacent columns to the right.
Procedure
- Use an existing table or create a new one of multiple columns
- Placed the cursor into a cell of the table where you want the text frame to start. In the example below, it’s in the first row and second column.
- IMPORTANT TIP: If the cell where you intend to anchor the frame is empty, enter a space into the cell so that there is a character within the cell to which the frame can be anchored. If you do not perform this step, it will appear that the frame has not been inserted which can be confusing
- Now, choose Insert > Frame from the menu and the following dialog box will appear:
- Make the changes as shown above
IMPORTANT NOTE: Some users of OpenOffice have reported that the use of “To paragraph” Anchors when using a high number of frames (e.g., > 200 rows with 1 frame each), has lead to considerable loading time for the document. “To character” anchor points do not seem to have this issue so we recommend that users of Blue Prairie Forms avoid the use of “To Paragraph” anchor points within templates, especially for templates that may expand at run-time into hundreds of rows.
- Make sure that all AutoSize and “Follow Text Flow” check boxes are not checked and otherwise check the options so that they match the above. The actual width and height is not important to check and we’ll adjust that in a subsequent step. But it is a good idea to set the position and vertical setting as shown.
Now, select the “Background” tab and choose the color white and then set the transparency to 100%, This will allow the borders of the table rows and columns to ‘show through’ the frame.
- Choose the “Wrap” tab and choose “Through”
- click OK and a frame will appear in the table cell with green corner anchors like this:
- Drag the corners (green anchors) of the frame until it is a size and position that you desire. Remember that it is very important that the frame be attached to the paragraph mark anchor. This is indicated by the little anchor symbol being hovering over the paragraph mark as shown above.
- If after dragging the corners of the frame to the desire size, the anchor moves to another cell or if you find it difficult to get the frame and the anchor to co-exist next to each other, it could be because the frame is set for ‘center’ justification (meaning it will attempt to be placed in the center of the cell rather than left justified and placed at the left edge of the cell. To correct this, select the frame so that the green corner markers are visible and then press the left justify icon in the toolbar:
- Size and position the frame so that it envelopes the columns that you wish to have your text ‘overflow’ into (sample shown below):
- Now click inside of the frame and add your desired tag like this:
As the ‘row’ is repeated, the frame within it will also be repeated. This will allow text to ‘flow over’ a number of columns because it will be constrained by the frame. Also, you can choose to eliminate borders on the frame so that these are not visible.
You can play with that to get a look that works for you. In theory, if we have a tag that is only for data if it should be in the frame, then the frame will be repeated along with each row for the number of rows of data but if the tag to be placed within the frame is blank, then only an invisible frame will be repeated in that cell. Now, if a row contains non-flowing data, it works and if there is data for the flowing frame, it will also work.
Where to place tags
Remember that you’ll want to include tags into the actual proper columns of the table for the data that normally appears in the columns. We’re simply adding the frame to handle special exceptions when non-standard data needs to appear in a row of the table and the data should span multiple columns. So, as you model the table, it might actually look more like this before you add the frame:
After adding the frame to allow spanning, the table row would look like this:
Notice that the frame is over the table row and that the anchor icon is attached to the paragraph mark in column 2 of row 2. This means that the frame resides in row 2 column 2 and then when the row itself is repeated, the frame should also be repeated.
Also note the there are two tags (%partNo% and %myTag%) that seem to be overlapping but not quite aligned. We’ve purposely misaligned the two so that you can see both tags in this example. In practice, you would probably align the frame so that the tag within the frame lays directly over the tag in column 2 row 2 of the table.
When then print program (MultiValue Host) creates the tags for this row, if the print program was going to print data that spanned columns, then the print program would place the spanning data into the %myTag% tag and would set the other tags behind the frame in the actual table row (%partNo%, %desc%, %price%) to null. Now, the data in the %myTag% tag would not collide visually with anything behind the frame within the actual table cells
If the print program is not printing spanning data, then the print program would need to set the %myTag% tag to null and the other tags within the table row (%lineNo%, %partNo%, %desc% and %price%) would contain proper values to be display.
Since the frame was configured to use white background color with 100% transparency, the table cell boundaries would be visible through the frame. This simulates the effect of printing across a pre-printed form.
Blocking column borders when spanning
You can employ a trick to ‘erase’ the column borders when the spanning tag is used. To do this, create two images somewhere in a URL visible to the print server (you can store it on the print server for fastest performance). You must use an image format that supports transparency. JPG does not support transparency but PNG does support transparency.
Image name |
Size |
Color |
transparentBackground.PNG |
Large horizontal rectangle |
Transparent |
whiteBackground.PNG |
Same as above |
White |
Procedure
- Right click on the frame and choose “Properties”
- Choose “Background” tab
- Choose “As” to be Graphic
- Click browse and find the transparentBackground.PNG file stored on the linux print server
- Make sure that ‘Link’ is selected
Of course, the example URL shown above is wrong and reflects a url on this author’s PC where he left a sample image. The URL you’ll have should be a URL from the print server where the image has been placed. The easiest way to make this change is to VNC into the print server and run OpenOffice or LibreOffice from there and then browse to the transparentBackground.PNG image. But for the purposes of this tutorial, it does not matter. All we need is to have the frame set for a background of “graphic” and some URL inserted into the frame. When the print program grabs the template to create the final document, the entire URL or the “transparentBackground” part of the URL will be swapped to the actual image URL you wish to use as the background.
So, in the print program on the MultiValue host, you’ll set a tag that is within the tag block for the repeating data set called transparentBackground and it will be set to the string “transparentBackground” if you want a transparent background for that row.
If the row in the repeating set calls for the background of that row to be white to block out the cell borders, then for that row, the tag transparentBackground to a value of “whiteBackground” instead of “transparentBackground”.
When the document is rendered, depending the preference of the print program, the frame for that row will either have a transparent background which does not block the cell boundaries or a white background which does.
Or Replace the Entire URL
Technically, you could also replace the entire URL with another using the same technique. This would be helpful in cases where you aren’t sure where the image will be stored and would rather replace the entire background graphic URL rather than just the file name part of the URL.
Tab Stops and Rulers
For data that needs to flow over a number of pages, one practice is to format the columnar data using tab-stops and then embedding tab characters (odt/tab format) into the tag data. By formatting the data this way, OpenOffice will automatically handle the pagination and render the headers and footers and appropriate to create the final document. See the Blue Prairie Forms api documentation for how to create repeating data using odt tabbed tables.
Frames
Frames are useful when you wish to have data overlaying a section of the document and do not wish to have it affect other parts of the document.
External Images
ODT format allows the template designer to embed images into the document or to place an external reference to a image into 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 OpenOffice documentation for more information about images and externally linked images.
Headers and Footers in OpenOffice
Header Example
The header generally repeats at the top of each page. OpenOffice allows for a variety of header option including even/odd page header, first page header, last page headers, etc. When designing a template in OpenOffice for use with Blue Prairie Forms, all of the OpenOffice capabilities are available to you as a form designer.
In the example above, we used for our logo, masthead, 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.
Document Body Example
The columnar report data in the sample above was injected into the BODY of the OpenOffice Document using a single tag. The tag was replaced by a large data set whereby each column was separated by a tab mark and each row was separated by a newline mark. Rulers were applied to the tag to define the position of each column and each column’s justification (left, right, justified, etc).
Because the large data set inserted in place of the tag had a greater number of lines than could be displayed within the available space in the document body area, OpenOffice automatically paginated the output causing the data to flow onto page 2 and beyond. No programming was required to count lines or inject page breaks.
In release 3.0 of Blue Prairie Forms, OpenOffice tables can be used to render tabular/columnar data. Special tags have been developed to associate sets of repeating transactional data with a conventional table object rather than using tabs and lines. The tables auto-adjust with rows being added as needed to accommodate the number of rows in the data being presented. OpenOffice handles the pagination according to the rules defined in the OpenOffice options. See the section entitled “Repeat Tags” for more information.
Footer Example
Footers are used to display data that should be repeated at the bottom of each page. OpenOffice supports options similar to header options to allow for different footers for the first/last page, odd/even pages and other specialized controls. In the example above, we used a table followed by a normal document (non-tabled) area for footnotes, etc.
Frame Example
The section of the above example to the left that is flipped ninety degrees was done with an OpenOffice Frame. Frames are useful for defining areas of the document where certain text sections should be confined or styled in a particular way. In the example above, we flipped the address information 90 degrees to show through a windowed envelope.
Images
OpenOffice support images that can be either an image embedded within the document or a reference for a document stored externally to the document and references via a URL. The URL-based image insertion method is preferred because the image does not live inside of the document and this means that the resulting documents are smaller. However, the URL to the Image must be visible on the network wherever you intend to distribute the document. Note that image URLS may contain tags (placeholders). This can be useful when the image you wish to display depends on data within the document. For example, if you wanted to display a photo of the sales person on an invoice, you could insert an image into the document template and then modify the URL to the image to look something like this:
http:/mydomain.com/images/salespeople/%salesRep%.jpg
If the placeholder tag %salesrep% was set to the value of “rick” then the Blue Prairie Forms would alter the above url to:
http:/mydomain.com/images/salespeople/rick.jpg
Remember that if you are inserting an image based on a link, it is vital when using Open Office to set the URL of the file, to check-mark the 'link' option as circled in red below. This causes Open Office to seek the image at the URL rather than saving the image into the document itself. Especially in cases where you intend to embed an image with a name based on a BP Forms tag, you must check 'link' so that Open Office will load the image from the URL when the document is opened and/or rendered.
Tables
Tables can be an extremely useful element when designing forms. In the example above, you can see that we have used tables in the headers and footers to control formatting and placement of the various elements.
When dealing with repeating data such as invoices that may contain many rows of repeating data, we have special tags that can be used within OpenOffice to allow OpenOffice element such as table rows to repeat for as many rows as the data being sent from the host. For example, if you have an invoice with 10 rows of data, you can create a table of one row and then add special tags to the table to cause that one table row to repeat for as many rows (10 in this example) as you have rows of data. A further description of special tags can be found elsewhere in this document.
Template Tags
Blue Prairie Form templates contain static elements and dynamic elements. Static elements are those that look exactly as they appear in the template when final document is produced. Dynamic elements change depending on the data being passed to the document for presentation. Consider the following snip from a Customer Statement template:
On the pages to follow, we'll break out and explain each section of the example template.
Template Example Detailed Explanation
This is the header section of a sample statement template.
Element |
Description |
IWI Logo |
(static) is a JPG image. |
“Please Send all...” |
(static) is simple text along with all of the text in the lines below it |
STATEMENT |
(static) is simple text |
%s_stmt_date% |
(dynamic) is a tag placeholder. When the document is rendered, this tag will be replaced with the actual statement date of the statement document |
Page | 1 |
Page | is simple text but the 1 is a OpenOffice field that displays the current page number. |
%c_name% |
(dynamic) is a tag placeholder. When the document is rendered, this tag will be replaced with the customer name for the statement |
Reference... Customer Ref... |
This is a simple one tow eight column table that will be the column headers for the body of the document where the actual statement detail will appear. Since this is in the header, it will repeat at the top of each page. |
There are several other tags that we have not documented because they are basically the same as the others
It is important, however, to note that there are two tables in this header snip; the one that holds the logo, mast head , page number and another that shows the column headers for the detail lines of the statement. This illustrates how a combination of word processing elements mixed with tags can allow presentation of a concise and easy to define header structure using conventional word processing techniques.
The snip below is a expansion of the operative part of the template
Element |
Description |
Previous Total Due |
This is static text that serves as a label. Note that it is one tab position from the left margin. This was achieved by simply pressing tab to move the cursor to this position. |
%s_prev_bal% |
This is a dynamic tag (placeholder) showing where the previous balance should be inserted. Note that this is several tab positions to the right. By using tabs, the previous balance value will be inserted into the final document at this tab position. This happens to be in the “Credits” column. |
Prev Bal |
This is static text that serves as a label |
%s_prev_bal% |
This is the same as %s_prev_bal% above only it appears in the rightmost tab position. In this example (above), the text will appear right justified in the Amount column. |
The snip below is a expansion of the footer of the template. This will repeat on each page because the footer specification in the OpenOffice document is set to repeat.
Element |
Description |
%s_age_lbl_1% |
This is a tag placeholder showing where to insert the label for this column. In the example final document (above), this reads 0-30 which is the column header. For this example, the business application statement generation program examined the customer records and only if the customer has a balance in a aging bucket (0-30, 31-60, 61-90, 90 over) does the statement print a label on that aging box. So, if the customer has only 0-30 aged balance and no 31-60, 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). |
New Balance |
This is static text |
%s_cum% |
This is a tag placeholder for the cumulative balance |
All NSF... |
This is static text |
Codes... |
This is static text |
PLEASE SUBMIT... |
This is static text |
Note that in the snip above, we have a table with two rows and six columns. The text appearing below the table was created with straight text (no table) and tab stops.
The snip to the left contains two OpenOffice frames with text inserted. It is used as a reference tab to help those who stuff envelopes detect the beginning of the next statement and with reference information to easily match to its mailing label. We created this in OpenOffice by creating a new frame, anchoring it to the page (not the paragraph) and then dragging it to the left page border. In addition, we changed the properties of the frame to allow vertical orientation of the text. |
Using Special Characters for Effect
Most word processors, including Open Office / Libre Office provide a wide range of fonts with special character sets that can be used to enhance your forms. Using these special characters can be done by simply:
- Load the template document into Open Office / Libre Office
- Click where you wish for the special character to appear
- Choose Menu>Insert>Special Character
- Select the font set (hint: Wingdings, Wingdings2, and Wingdings3 contain many useful and scalable glyphs)
Special Characters: Wingdings2
After inserting the symbol into the document, you may select it then change the font size to make it larger or smaller. Special symbols allow you to create many attractive effects within your form templates without resorting to the insertion of images. This keeps your templates small, fast and scalable.
Example Form Template with Special Characters
Note:
- The icons (special characters) used for email, address and phone. These all came from the wingdings2 special character set.
- The Swoosh-Right_arrow to the right of the "Please pay this amount" label came from the wingdings3 special character set.
You may explore all of the font sets available in open office to find and use eye-catching icons and special characters for your templates.