WPReporter is an add-on for the WPTools VCL. It is included in the 'WPTools Bundle' and can also be purchased seperately if you already bought WPTools. It includes a tool to create documents from a template and data (RTF reporting) and to add calculation to text and tables.
The token to template conversion uses special character combinations to separate the commands from the text. Fields have to be embedded into the characters << and >>.
Example for fields:
The name of a field may contain space characters.
Optionally the closing '/' character can be printed:
Using such fields mail merge documents can be created. Such merge documents only require fields to be filled with data. Using mail merge does not require the reporting extension so we decided to make the syntax highlighting and token to template conversion available in the basis edition.
Bands are identified by a colon (':') after the opening << characters.
Example for header bands:
This starts a group header or, if used outside of any group a document header text. In the latter case the following variations are possible:
HEADERF = header on first page only
HEADERO = header on odd pages
HEADERE = header on even pages
HEADER_OFF = this header is disabled.
Please note that bands are not implemented using opening and closing tokens ("i.e. <<..>>...<</...>>") so optionally the closing '/' character can be typed: <<:HEADER/>>
Example for footer bands:
This starts a group footer or, if used outside of any group a document footer text. In the latter case the following variations are possible:
FOOTERF = footer on first page only
FOOTERO = footer on odd pages
FOOTERE = footer on even pages
FOOTER_OFF = this footer is disabled.
Inside header and footer bands fields, images and text is possible. A header and footer band ends where either a different header or footer band starts or a data band:
Bands must be the first non white space (white space= space or tab characters) in a paragraph. All text after the band token will be ignored and can be used to write comments.
Groups are identified by a double cross ('#') after the opening << characters. While bands <<:.../>> are not nested, groups can be nested and so are embedded into a tag pairs <<#...>> <<#/....>.
Unlike header and footer bands the name of the group tags are not fixed. Practically any name can be used if it does not contain spaces. However the opening token must match the closing token. For practical reasons the names should match the database which is referenced inside of the group.
<<#CUSTOMERS>> comment: we list all customers in this group
<<#ORDERS>> comment: we list all items ordered by the current customer
Note: The name of a group will be passed to the event OnReportState while creating a report. This event has to decide if a group should be processed (again) or not. It can create a sql query and calculate sub totals.