List of All Commands
Following a list of all commands that can be used to control the ODTCreatorUnit. If a command encloses a block, we call it a block tag. If it is replaced by a value, we call it a value tag. Additionally, there are action tags that have a control function and do not directly influence the creation of the document.
table
Type: Block tag
Format: odtcreator:table:<node name>
A table block always encloses a table. The content rows of the table are repeated for each dataset with the specified node while the header line will only be displayed once. The header line is usually generated automatically when the table is created (in OpenOffice). If the table shall contain several header lines that are repeated for each data set, you are not allowed to use 'real' header lines. Delete the 'real' header line and replace it with a normal line that is simply formatted as if it were a header line.
The node used for the table has to be directly underneath the node of the current block. Inside the table block, you are in the referred block and have access to its fields and nodes.
tabledeep
Type: Block tag
Format: odtcreator:tabledeep:<node name>
The tabledeep command basically works like the table command, but the node used for the table does not have to be directly underneath the node of the current block. Under certain circumstances, that can save a few blocks if they are only needed to reach the node used for the table.
deep
Type: Block tag
Format: odtcreator:deep:<node name>
Similar to tabledeep, you can save a few blocks if you only need quick access to a node several levels below the current node. In our invoice example, we could go directly from block Invoice to block ItemHeader. Using 'normal' blocks, you would have to go to the node Item first.
Example without deep:
{--Invoice--}
...
{--Item--}
{--ItemHeader--}
Position {--PositionNumber--}: Item number {--ItemNumber--}, {--ShortDescription--}
{--/ItemHeader--}
{--/Item--}
...
{--/Invoice--}
Example with deep (in just one step):
{--Invoice--}
...
{--odtcreator:deep:ItemHeader--}
Position {--PositionNumber--}: Item number {--ItemNumber--}, {--ShortDescription--}
{--/odtcreator:deep--}
...
{--/Invoice--}
parent
Type: Block tag
Format: odtcreator:parent
This command can be used to go up one hierarchy level. The content in the parent block then refers to the data set of the superordinate node. If you used another parent block inside the block, you could go even higher.
Example:
{--Invoice--}
...
{--odtcreator:deep:ItemHeader--}
Position {--PositionNumber--}: Item number {--ItemNumber--}, {--ShortDescription--}
{--odtcreator:parent--}
Detail information:
{--ItemDetail--}
{--DetailText--}
{--/ItemDetail--}
Additions:
{--ItemAddition--}
{--AdditionalText--}
{--/ItemAddition--}
{--/odtcreator:parent--}
{--/odtcreator:deep--}
...
{--/Invoice--}
if
Type: Block tag
Format: odtcreator:if:equal:<field>:<value>
or: odtcreator:if:notequal:<field>:<value>
or: odtcreator:if:textis:<value>
or: odtcreator:if:textisnot:<value>
or: odtcreator:if:inelement:<element name>
Conditions equal and notequal:
This block will only be evaluated if the stated field has the desired value (equal), or not (notequal).
Conditions textis and textisnot:
If you are in a block that refers to a field, you can check the value of that field.
Condition inelement:
This condition only makes sense in an in block. The if block is only evaluated if you currently are in an element (node or field) with the specified name. An example can be found in the description of the in command (example 2).
Example 1: equal
{--Invoice--}
...
{--Address--}
...
{--odtcreator:if:equal:Title:Mr--}
Our special offer for the gentlemen: ShaveTech USB travel razor for 9.99. Check out our website.
{--/odtcreator:if--}
{--odtcreator:if:equal:Title:Mrs--}
Our special offer for the ladies: USB Hand Warmer Mouse Pad for 8.99. Check out our website.
{--/odtcreator:if--}
{--/Address--}
...
{--/Invoice--}
The condition notequal is evaluated accordingly.
Example 2: textis
{--Invoice--}
...
You get a special offer price for following item:
{--odtcreator:deep:AdditionalText--}
{--odtcreator:if:textis:Special offer--}
{--odtcreator:parent--}
{--odtcreator:parent--}
{--ItemHeader--}
Position {--PositionNumber--}: Item number {--ItemNumber--}, {--ShortDescription--}
{--/ItemHeader--}
{--/odtcreator:parent--}
{--/odtcreator:parent--}
{--/odtcreator:if--}
{--/odtcreator:deep--}
...
{--/Invoice--}
In this example, all the additional texts are checked for containing the value Special offer. If so, the header information of the respective item is displayed. For this purpose, we have to work our way up, starting at AdditionalText via ItemAddition (1. parent) to Item (2. parent) and then step into the node ItemHeader. The condition textisnot is evaluated accordingly.
in
Type: Block tag
Format: odtcreator:in:[list of node names] or odtcreator:in:*
This command allows you to access all the subordinate nodes and fields of the current node. You either specify the desired node names (separated by :) or use an asterisk (*) for all subordinate nodes.
Example 1: Display the names and values of all fields of node ItemHeader
{--Invoice--}
...
{--odtcreator:deep:ItemHeader--}
Position {--PositionNumber--} has the following content:
{--odtcreator:in:*--}
{--odtcreator:elementname--} = {--odtcreator:elementtext--}
{--/odtcreator:in--}
{--/odtcreator:deep--}
...
{--/Invoice--}
The commands elementname and elementtext are explained below.
Example 2: Combined with if:inelement
{--Invoice--}
...
{--Item--}
{--odtcreator:in:ItemHeader:ItemAddition--}
{--odtcreator:if:inelement:Item Header--}
Position {--PositionNumber--}: Item number {--ItemNumber--}, {--ShortDescription--}
{--/odtcreator:if--}
{--odtcreator:if:inelement:ItemAddition--}
Addition: {--AdditionalText--}
{--/odtcreator:if--}
{--/odtcreator:in--}
{--/Item--}
...
{--/Invoice--}
In the block referring to the node Item, the in command passes through the nodes ItemHeader and ItemAddition. Depending on which subordinate node is currently accessed, the corresponding row is displayed. Of course, this is a bit useless in this case, since we could have accessed the nodes directly, but it shows the principle.
elementname and elementtext
Type: Value tag
Format: odtcreator:elementname or odtcreator:elementtext
Those two tags are replaced with the name of the current element (node or field), respectively the text (the value) if it is a field. An example can be found in the description for command in (example 1).
define and undefine
Type: Action tag
Format: odtcreator:define:<arbitrary text> or odtcreator:undefine:<arbitrary text>
Those two tags have no direct effect on the text and are replaced with an empty string. However, the ODTCreatorUnit remembers the specified text as defined, respectively deletes that definition again. Such a definition can be used for checks in the commands ifdef and ifundef (see below).
In the following example, we extend the display of the special offer items (example 2 of the if command) by one row that is only displayed if no special offer item has been found. For this purpose, we use the command ifundef.
Example: Display line, if there are no special offers
{--Invoice--}
...
You get a special offer for following items:
{--odtcreator:deep:AdditionalText--}
{--odtcreator:if:textis:Special offer--}
{--odtcreator:parent--}
{--odtcreator:parent--}
{--ItemHeader--}
Position {--PositionNumber--}: Item number {--ItemNumber--}, {--ShortDescription--}
{--odtcreator:define:Special offer found--}
{--/ItemHeader--}
{--/odtcreator:parent--}
{--/odtcreator:parent--}
{--/odtcreator:if--}
{--/odtcreator:deep--}
{--odtcreator:ifundef:Special offer found--}
Unfortunately there are no special offers for your order.
{--/odtcreator:ifundef--}
...
{--/Invoice--}
If you want to do a similar check later, you can delete the definition {–odtcreator:undefine:Special offer found–}.
ifdef and ifundef
Type: Block tag
Format: odtcreator:ifdef:<arbitrary text> or odtcreator:ifundef:<arbitrary text>
The ifdef block is only evaluated if the specified text has been defined with the define command. The ifundef block, on the other hand, is evaluated if the specified text has not been defined, or has been erased by the undefine command. An example for the usage of ifundef can be found in the description of the commands define and undefine (ifdef is used accordingly).