During invoice template creation the main instrument which you will use to display data in the report will be Field list. You must clearly understand its meaning to efficiently create templates. In the built-in templates field list contains one single table called Invoice. This table provides access to all invoice fields and nested tables. All invoice rows re contained in the Invoice to print table. Selected payments methods can be found in the Payment methods table.

Nested User property provides access to your personal data (your name, address and other details specified in the program settings).

Expand Invoice table and see which data it contains:

It contains a number of fields of different types. Type of field is determined by an icon. Some fields contain an arrow near icon, which means that this field contains nested fields. Nested fields may be contained in the reference fields (example is a customer, which has name, VAT code, address, etc.) or in table fields (examples are Rows to print or Payment methods nested tables, which contain set of rows).

If a field isn't referenced field or table field, than it can be placed on the design surface. For example, we'd like to display invoice date on the surface. The easiest way to do this is to drag and drop Date field inside corresponding band. The program will automatically create label control and bind it with Date field. When any control is bound to any table field, a yellow icon is displayed in the top right corner of that element:

Another way to bind an element with a field is to use toolbox panel. Drag and drop Label element from the toolbox, open its helper menu and select a field to bind to:

To change binding, open helper menu again and change value in the Data binding property. Or, you can simply drag and drop any field from the Field list over existing control, and its binding will be automatically changed.

When a control is placed on the design surface, the next very common task is to change its formatting. By default, all dates are printed using full form of date (with hours, minutes and seconds). Number usually contain too much decimal places, while you usually need to display only 2 decimals. To change formatting, open helper menu of the element and click ... button in the Format string property. In the opened window, depending on the type of formatted value, select desired options. For dates, your common choice will be d value. For numbers - n2 (number with thousands separator and 2 decimal places).

Another interesting feature of format string is possibility to add prefix and postfix to the value. When any formatting is applied, you will see the following picture in the Format string property:

If to type something before or after {0:d}, than this value will be printed along with field value. For example:

Now, in addition to due date, the word 'Deadline' will be printed before it. This technique will be useful when printing customer VAT number. If customer don't have VAT number, the whole value won't be printed. But if a customer has VAT number, the following string will be printed in the invoice: "VAT: 2323232". Thus, you will avoid situations when invoice contains "VAT: " string, but actual VAT won't be specified.

Mail merge binding

Template designer provides another way to bind elements to data. This feature is called mail merge and allow to bind one element to multiple fields. This is useful, when you want to print different data from the source table, but using of separate labels isn't sufficient because of arrangement limitations. For example, you want to print invoice amount and put currency symbol before it. Yes, it is possible to place 2 elements, and bind the first one to the currency symbol, and the second to the amount itself. But since amount may be of different length, how to place both elements in relation to each other:

The best option will be putting currency symbol, followed by the amount after single space. In such cases, mail merge function will be a solution. To use it, do the following:

1. Place label control on the report surface.

2. Double click on it to start editing.

3. Enter square brackets and drag necessary field from the Field list inside first pair of square brackets.

4. Type another pair of square brackets and drag second field from the Field list inside it:

5. Now, invoice amount will take the following form: "$ 1346.32000". Close to desired result.

6. For mail merge boxes, simple way of setting format string won't work, because such element is binded to several fields, which may have different types. To apply formatting to each included field, type exclamation mark before closing bracket, followed by format string. For example:

7. Done. Now we'll get desired result: "$ 1 346.32"

Created with the Personal Edition of HelpNDoc: Free PDF documentation generator