This sample will create a simple report from the Customers database that comes with Delphi. The template is created with MS Word 2013.
The bands in the report is defined with comments. Report fields is defined with field codes.
Open an empty document in MS Word.
Enter the report page header. This text will be printed on top of each report page. Use tabs to separate the report columns.
Select the heading text.
Create a comment.
In MS Word:
- Select the Review tab
- On the Comments pane. Click New Comment.
Add band parameters.
This band will be a page header band.
- Write "-band". This must be the first line and defines the comment as report band. Without it, the comment is ignored.
- Write "Name: [PgHeader]". The name, in this example "PgHeader" can be any name that is not used elsewhere.
- Write "Type: PageHeader". Type is the band type, in this case a page header.
Create the fields of the band.
A band field is defined with field codes.
- Place the curor under Company and select the Insert tab.
- On the Text pane, click Quick Parts.
- Select Field...
- Browse to MergeField and select it.
- In Field name, write "Company". This is the name of the database field.
- Click OK
Repeat 5 for the rest of the fields.
To edit a field, place the cursor in the field text. It will become gray. Press Shift+F9. You can now edit the field codes. The text "\* MERGEFORMAT" is a field parameter used by MSWord that can be deleted. AXWReport uses other field parameters that you can read about in the documentation. Press Shift+F9 again to clode the field editor.
Create the data set band
Repeat 3 and 4 to create a comment, but select the field codes instead.
- In the Type: parameter, write "DataSet" as this is a data set band.
- Add a DataSet parameter and write "tblCustomers". This parameter can be omitted if the database fields are in the data set property of the TAXWReport object.