WPCubed GmbH
Wordprocessing and PDF components 

Reporting ComponentWPReporter

Add bands and groups to your "mail merge" form in WPTools. This makes it easy to create documents with text and data loaded from a database or other sources.

WPTools comes equipped with a robust and flexible mail-merge feature. However, if you require creating extensive documents with lists and tables, you can employ WPReporter to bundle fields into bands and groups. This allows for easy exporting of data to generate detailed reports.

 

WPReporter is an add-on for the WPTools VCL. It is included in the "WPTools Bundle", "WPTools Premium"  and can also be purchased separately if you already bought WPTools. (Also included in the Bundle and Premium edition is since WPTools 8 the component TWPTextProducer. It is a unique and powerful tool to create and update tables within a document in the WPTools editor component).

WPReporter also includes a tool to create documents from a template and data (RTF reporting) and to add calculation to text and tables. It can be described as a extended implementation of mail-merge. Instead of just having fields in the template, it also allows to use groups (for conditional merging and master-client relations ships) and bands, to create header and footer.

The templates can be created and edited in the regular editor. Bands and groups will be displayed graphically.

It is also possible to have tokens in the text to be converted by a dedicated function to be used as template.

 

Syntax for Token-To-Template conversion

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:

<<name>>

The name of a field may contain space characters.

Optionally the closing '/' character can be printed:

<<name/>>

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:

<<:HEADER>>

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:

<<:FOOTER>>

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:

<<:DATA/>>

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.

Example:

<<#CUSTOMERS>> comment: we list all customers in this group
<<Customers.Name/>>
<<Customers.Address/>>
Ordered Items:
<<#ORDERS>> comment: we list all items ordered by the current customer
<<Orders.Name/>>
<<#/ORDERS>>
<<#/CUSTOMERS>>

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.