Create Invoice Header With Number and Date

Use the text object again to add the text "Invoice", the invoice date and the invoice number to an invoice header.

Figure 2.34: Invoice header: it should look like this.

1.  Choose Insert > Text (Objects > Insert > Text).

2.  Pull the object to the required size.

3.  The formula wizard will now appear, which you can use to define the contents of the text object. Type "Invoice".

4.  Add another paragraph by means of the tab Text Tools > Text (mini-toolbar) and the "Append" button.

5.  The formula wizard will appear. Type "Date".

6.  Before you enter the invoice date, insert a tab stop so that the invoice date is aligned to the right. You can insert a tab stop by means of the "Text" tab.

Figure 2.35: Adding a tab stop to a text expression

7.  You create a tab stop with the "Tab" button and you define the position and alignment with the "Properties" button.

Note: Only one tab stop can be inserted on each line. A tab stop causes the preceding text to run only as far as the tab stop. A tab stop that is right aligned will cause the text that follows it to be justified to the right. The distance from the left margin determines the position of the tab stop.

Since a tab stop is also a character, it must also be enclosed in quotation marks. Alternatively, in this example, you can insert the tab stop with "Insert" to the existing "Invoice date" text.

8.  Finally, position the cursor outside of the text field and insert the "Invoice_Date" variable with the "Data and Functions" tab.

The format will be converted automatically.

Conversion with the "Date$()" function is essential since the invoice date has the "date" type and the value that is returned is already defined as a "string" by the "Invoice date" text expression entered earlier. The return value must always be unique. The date value must therefore be converted to a string by means of a function. The "Date$()" function is one way of doing this.

Figure 2.36: Format conversion with Date$()

The automatic format conversion uses "%x" as the formatting parameter. If you want a different output format, switch to the "Date Format" tab. You can choose a format here and then select the "Invoice_Date" variable.

9.  Now add the invoice number in the same way.

The format will be converted automatically here as well.

Figure 2.37: Format conversion with Str$()

Conversion with the "Str$()" function is essential since the invoice number is a field with the "number" type and the value that is returned is already defined as a "string" by the "Invoice number" text expression entered earlier. The return value must always be unique. The number must therefore be converted to a string by means of a function. The "Str$()" function is one way of doing this. This function has 3 parameters: The first parameter is the number that is to be converted to a string; the second parameter specifies the minimum length and the third parameter the number of decimal places.

10. Now increase the font size for "Invoice". To do this, select the relevant line.

11. Set the font size to 24 by means of the "font size" button in Text Tools > Text (mini-toolbar).

12. Now open the paragraph properties dialog via double-click to increase the distance to the next line. In this dialog, you can define the properties for each line. Set the value for the "Paragraph Spacing" property for the first line to 12 pt.

Figure 2.38: Paragraph properties dialog

13. And you now have an attractive invoice header.