Print Properties
2 - Working with letter templates

Inforama tutorial

You can download the Inforama project files for this example by clicking the attachments link at the bottom of this page.

Creating a new letter template

You can create a new letter template by clicking the File – New document... menu item and the dialog shown in figure will be displayed.

 

Figure 1: New document dialog

 

Enter the name that you want to give the document, select Letter from the Document type list and click the Create button. The new letter template will appear in the Documents frame and the new letter template will appear in the main document frame as an OpenOffice document as shown in figure 2 below.

 

Figure 2: The new letter template within the Studio

 

You can now start creating the template in the OpenOffice editor. As you can see in the screenshot the entire OpenOffice application is embedded within Inforama Studio. The OpenOffice menu can be toggled on and off by clicking the toolbar button marked as 1 in figure 3 below.

 

Figure 3: The OpenOffice editor toolbar

 

Click the button marked 3 in figure 3 and the Letter Manager dialog will appear as in figure 4

 

 

Figure 4: The letter manger dialog

 

 

Click the Preview button and the document will render in the Document preview dialog as shown in figure 5 below.

 

Figure 5: Previewing the document

 

The Document preview dialog has a number of features which are listed in the following table...

Item

Description

1 – Refresh button

Generate the PDF again from the template

2 – Print button

Print the generated PDF. This will only work if a print output method is specified in the project options

3 – Save button

Save the PDF document to file. You will be prompted for the location to save the generated document to

4 – Show PDF button

Display the saved PDF in the default system PDF viewer. This button will become enabled after the PDF is saved using the save button above

5 – Fit width button

Fit the PDF into the width of the preview area

6 – Fit height button

Fit the PDF into the height of the preview area

7 – Full size button

Display the PDF in it's full size

8 – Zoom in button

Zoom in on the PDF

9 – Zoom out button

Zoom out of the PDF

10 – Page list

Lists the pages in the generated PDF. Select a page from this list to change the page being preview in the preview area

11 – Preview area

This is where the generated PDF is displayed


 

Passing parameters to the letter

Parameters can be sent to the Inforama document generation engine for a number of reasons including filtering on a dataset, display conditions, etc. but parameters can also be displayed within the document as text. In order to pass a parameter to a document the parameter name needs to be declared within the Inforama project. To do this expand the Parameters frame shown in figure 6 below.

 

 

Figure 6: The parameters frame

 

Click the button marked 1 in the Parameters frame and you will be prompted to input a name for the new parameter. In this example the parameter name has been specified as dividy_username. Click OK in the dialog and the new parameter name will appear in the parameters list marked as 3 in the screenshot. Now to make a placeholder for this parameter in your document template, open the template and remove the name at the bottom of the template. Place the cursor where you want the parameter to appear and double-click the parameter name in the Parameters frame. The parameter name will appear in the template as shown in figure 7.

 

 

 

 

Figure 7: The parameter within the document template

 

nce again click the button marked 3 in figure 3 and the Preview button in the resulting Letter Manager dialog. This time when the Document preview dialog appears the document won't generate automatically. Instead, in the Required parameters section on the bottom left of the dialog the parameter will appear with the text <not specified>. Select the parameter by clicking it in the list and click the Modify parameters button. You will be asked for a parameter value in the resulting dialog and when all parameters have been completed the document will generate as shown in figure 8.

 

Figure 8: Displaying the parameter in the document preview dialog

 

The screenshot shows that the parameter value which was input replaced the parameter placeholder in the document template. Whatever parameter value was last input on this dialog will appear automatically whenever this project is used.

Working with letter fragments

There may be cases where you wish to construct a compound document out of a series of standard paragraphs or fragments. This can be achieved by using letter fragments within Inforama. Start by clicking the File – New document... menu item. In the New document dialog enter the name of the letter fragment you want to create and select Letter Fragment from the Document type dropdown list as shown in figure 9.

 

Figure 9: Creating a new letter fragment

 

Click the Create button and the new letter fragment will appear in the list of documents in the Documents frame as well as opening for editing within the embedded OpenOffice editor. In this case we're creating a standard conditions paragraph which will appear at the bottom of certain documents.

When the document appears in the OpenOffice editor enter the text that you would like to appear. Now re-open the WelcomeLetter document template and place the following text at the bottom...

$fragment{StandardConditions}

 

This is shown in the screenshot in figure 10 below.

 

Figure 10: Including the fragment in a document

 

Now when you preview the document the fragment content will be included in at the bottom of the main document as shown in figure 11.

 

Figure 11: Previewing the document with the fragment included

 

It's also possible to merge a number of document fragments. Create a new fragment which we will call Intro. Next, open the Letter manager dialog and click the checkbox From fragments. Move the two fragments to the right-hand list and click the Preview button. The fragments will merge to create a single document.

Applying conditions to letter fragments

You may not always want fragments to be included in generated documents and the way to control this is to have them display based on conditions. In this example we will base our condition on a parameter which we will pass to the Inforama engine.

In the Parameters frame create a new parameter called include_conditions. Now re-open the WelcomeLetter template and scroll to the bottom where the condition was inserted previously. Replace the include command with the following...

$IF{$E{$P{include_conditions}}, $fragment{StandardConditions}}

 

Now preview the document in the Letter manager dialog and set the include_conditions parameter to the value true. The fragment will display as shown in figure 12 below. By default you can supply values of true, on, yes or 1 to commands using this syntax in order for them to evaluate to true. If the parameter is any other value or blank the fragment will not appear.

 

Figure 12: Fragment displaying depending on condition

1525 Views, 1 Attachments 1 Attachments

  • Comments
Copyright © 2008 - 2010