Word Report Builder

Word Report Builder is an easy to use Microsoft Word based reporting tool for database applications. It enables the use of MS Word for the creation and editing of various styles of sophisticated reports (standard, columnar, master-detail).

NOTE: You must have MS  Microsoft Word 7.0,8.0, 2000 or 2003

Word Report Builder enables the creation of reports of the following types:

 1. Form Reports (for example agreements, notices, references).

 2. Columnar Reports (a set of tables).

 3. Master-Detail Reports (Combination of form and table-itemization). For example, an income reference which corresponds to a table of monthly incomes.

Report  Examples

Report type 1 (Form) example:

Supplier: ######2(¹ #######1).

Address: ###########3.

City: ########5.

State: ####6.


Report type 2 (Set of tables) example:

Table 1
@1 @2 @3 @4 @5
Table 2
@1 @2 @3 @4 @5

Report type 3 (Combination of form with table-itemization) example:

Supplier: #2 (¹ #1). Address: #3. City: #5. State: #6

Delivery details:
@1 @2 @3 @4 @5

The templates for the table fields are in the form #N, where N is the number corresponding to a field’s position in the table, in sequential order from left to right beginning with 1.

The fields themselves can be inserted into the report at any location.

The number of # symbols should be greater than or equal to 1. If the length of the field template (###N) is greater than the length of the value to be inserted, the field will be padded either on the left, on the right or from both sides with spaces. The direction of alignment depends on the value of the parameter, ‘Alignment of inserted fields’. The font used for the inserted fields can be specified directly within the MS Word document form (on the field template) or in the program itself. The font name is specified in the parameter, ‘Font for inserted fields. Logical values are output as follows: True - (Windings 111); False - (Windings 254).

It is possible to use form fields in the document template. For example, if a field were typed into the template like so: ‘#12’, then in the output document it would be written (if the contents of the field were the value 10) like so: ‘10’ (ten)

Please not the following:

 1. There should be at least one space to the left of the first character ‘#’ (against the grey background) in the form field.

 2. The ‘REF’ field is updated automatically by the program.

 3. When printing the document, the parameter: “Upgrade fields during printing” should be set to ‘off’, as contents are automatically cleared by Microsoft Word when the form fields are updated.

When defining the template for a table, one row or (in the case of an inverted table, one column) should be specified. The templates for the table’s fields should be placed into the cells of the row (or column) in the form ‘@N’, where ‘N’ is the number corresponding to its left to right position in the table, beginning with 1.

The number of ‘@’ symbols should be greater than or equal to 1. If the length of the row of the field template (@@@ N) is greater than the length of the value to be inserted, the field will be padded either on the left, on the right or from both sides with spaces. The direction of alignment depends on the value of the parameter, ‘Alignment of inserted fields’. Fonts can be specified for both the first table row and for the body of the table. They can be specified either in the MS Word document form itself or in the Word Report Builder program. The font name is specified in the parameter ‘Font for inserted fields.

In some cases, the order of the field numbers in a table template might be random. Additionally, some fields may be absent. For example, the following table template:

@5 @1 @3 @4 @2

If there is no row of type ‘@N’ (an empty cell or any other value) in any cell of the first row (column) of the table template, or if the number of a field is greater than the maximum value for the inserted table, then that column (row) is ignored.

For example, in the following table template, only the 1st and 3rd columns (in the case where the source table has just 4 fields) will be filled:

@4 @1 AAAA @5 @5

There can be more than one row (or in the case of inverted tables - columns) in the table template.

In some cases, the heading of the table may be more complicated. If the number of prepared rows (columns) is not adequate, new ones will be added to compensate. If the records in the table turn out to be fewer than are provided in the template, the empty rows (columns) are not deleted.

Constraints on the number of records can be specified for each table: the left range limit of records for processing (>=1) and the right limit (>=0, 0 indicates that there are no limitations).

When filling a subject table (report type 3) the very first table in the document form is searched.

When defining a set of tables (report type 2) it is necessary to indicate precisely each table’s corresponding number according to its position in the document form.

It is possible to indicate the database when selecting the tables by using an ALIAS or a path to the directory. If neither an ALIAS nor the path are indicated, the current directory is used to search for the table.

All parameters of the report can be saved to a file having the extension *.REP for use at a later time for automatic report creation.

While the report parameters file is a standard text file, manual editing of this file is not recommended.

After the first scan of the report template, a file with the name of the template and the extension RPS which contains information on the results of the scan is created. The file is saved in the same directory where the document’s template is located. If the template has not changed following the creation of the RPS file (it is always checked when it is either created or changed,) the template is not  rescanned. All necessary information comes from the corresponding RPS. It is strongly recommended, to avoid confusion, that the name of the document form file be the same as that of the corresponding REP file. It is also best to create the document template beforehand using Microsoft Word, however it is also possible to create or edit the form using the ‘Edit Report’ button in Word Report Builder. When Microsoft Word is started, the the document form is loaded (or created) and an “Insert” window appears on the screen. It enables the insertion of the templates for the required fields into the document form, although this can also be done manually using MS Word.

To continue editing, close the “Insert” window by clicking in the right upper corner of the window title. MS Word itself does not need to be closed.

It is possible to edit the form and to generate a report without saving the changes made to the form. If you would like your changes to be saved, do it using Microsoft Word before pressing the “Run report” button.

Setting up a new report. Defining the report parameters.

Start the Word Report Builder program.

From the “Report” menu, select the item “New” and then select from among the report types: “Form Report”, “Columnar Reports”, or “Master-Detail”.




Explanation of report parameters.

The Form Report.

First, you must specify the name of the table. For this example, select the checkbox “Open tables by...”

It is possible to specify the table using either an Alias or a file name.

If the table is specified as an Alias, select the table from the appropriate list.

If the table is selected by its file name, double click the "Table Name" column and select the table from the list box.

Now it is necessary to indicate the range used for the creation of the records report: The left boundary is specified by a number >=1, the right boundary by a number >=0.
The number ‘0’ indicates that there are no limitations, i.e. when the report is created, all records in the table will be used.

The next step requires the selection of the filenames for both the document form and the report. It is possible to specify the filenames directly by typing them into the appropriate fields or to click the browse button to the right to navigate to the desired file.

To create a report, the form template file must exist. Therefore, after specifying a name for the form, press the “Edit Report” button to create a new template file.

Microsoft Word is then started and the specified file is either opened, or an empty file created. For your convenience, the “Insert” window appears. Place the cursor in the desired area of the form, select the desired table field from the list and press the “Insert field” button. To terminate the filling of the report form, press the “Close” button. Do not forget to save the changes before pressing “Close”! At this time, Microsoft Word may be closed, but it is not required. It is now time to specify the behavior of Microsoft Word during the creation of the report. Use the appropriate fields to indicate whether or not to display the Microsoft Word window (to view the report creation process) or to display the report only after its creation.

Both check boxes are selected by default. The next step is to specify the alignment type for the inserted fields: If the length of the row of the field template (@@@ N) is greater than the length of the inserted value, the value will be padded with spaces on the left, on the right or from both sides depending on the value of the parameter ‘Alignment of the inserted fields’. Otherwise the value fills the field completely. You may also specify the font to be used for the inserted fields. You can select the same font as in the template form (mark the check box “As in the form”) or select another font (mark the check box “select”). If “select” is chosen, the font selection dialog button is enabled.

Hint: To accelerate the creation of very large reports (for example, tables with hundreds or thousands of rows), specify the font used by the form rather than selecting a different font.

Logical values are output follows:

True - (Windings 111)

False -(Windings 254).

The following parameter determines the number of output files for a given report.

All documents can be saved into a single output file (the default setting) or a separate file can be created for each record.

In the latter case, the names of the output files are created by using the string in the line “... for the resultant document” and appending the number of the record (the numbering of records begins with 1). No limits are imposed on the length of these names.

Now the report parameters for “The Form Report” have been defined. Do not forget press the “Save” button to save these settings and to move on to the section “Operations after the definition of parameters”.
 

Columnar Report (set of the tables).

The columnar report allows the filling in of several tables at one time which can be located in several places in the document form.

The values and most of the parameters are described in detail in the section: “The definition of the report parameters. The type of the report: The Form”.

The additional parameters which are unique to this type of report are described below. These parameters specify the number of filled tables in the form of the report: It is necessary to specify these parameters for each table.

Switching from one table to another is performed by clicking the arrows in the upper left corner of the window of the form: Pay close attention to the parameter next to it. It is the ordinal number corresponding to the template of the given table in the document form. Of course these numbers will be different for each table.

It is also possible to indicate whether or not each table is inverted. Inverted tables have their rows and columns switched.

This type of report does not include a parameter for the number of output files, as it is always only one. Only a single font can be specified for all tables. If there is no data (records) for a given table during processing, the table is deleted from the report and the message: “No Data contained” is inserted into its position in the report. To edit the form for the report, click the “Edit Report” Button.

Microsoft Word is then started and either the specified file is opened or an empty file having the same name is created.

For your convenience, the “Insert” window appears. Place the cursor in the desired area of the form in the document. Select the table from the list and press the “Insert table” button.

Be aware that when inserting a table using this button, the table’s template is created in the following simplified manner
 

@1 @2 @3 @4 @5

for the standard non-inverted table and:
 

@1
@2
@3

for the inverted one.

The template includes all fields of the table but no heading is created. To insert an inverted table you must select the “Invert” parameter.
 

NOTE! Word does not allow tables to have more than 32 columns. Therefore, if you have used the “Insert table” button and the resulting table has more than 32 columns, it will be inverted automatically.

Hint: When you invert a table, make sure you limit the number of records to a reasonable number, keeping in mind that a table can have no more than 32 columns in Microsoft Word!
 

If it becomes necessary to specify a heading for a table, or to include only a subset of the fields in the table, the table’s template should be created using the tools available in Microsoft Word.

To terminate the filling of the report form, press the “Close” button. Do not forget to save any changes made to the form! Word may then be closed, but it is not necessary.
 

Master-Detail Report (Combination of form and table-itemization).

The Master-Detail report requires the definition of two tables: the values from the records of the main table are used to fill in the fields of the main form, and the rows of the itemization or “detail” table are filled using the records of the subject table.

The values and most of parameters are described in detail in the section “The definition of the report parameters. The type of the report: The Form”.

The additional parameters unique to this type of report are explained below. To limit the number of records in the itemization or “detail”, you may specify a ratio between a value of a field in the main table and values of the corresponding field in the records of the subject table.

You may select any of the following operators for the ratio: =, < , <= , > , >= , <>.

Both fields must be of the same type (numerical or string), and the names of the fields cannot be the same.

If the ratio fields are string values, the comparison is performed lexicographically.

Be aware that the filter specified by this ratio is applied to the records of the subject table before the numerical constraint specified by the parameter:.“Use records from ... to... ”

If it happens after applying the filter that the subject table returns a large number of empty records, the table is deleted from the report and the message: “No Data contained” is inserted in its position. You may also indicate whether or not the subject table is inverted. (Inverted tables are tables which have their rows and columns switched.)

Make sure that the subject table is the first table in the form of the report!

It is possible to use different fonts for the data in the main form, and data in the subject table for this type of report. To edit the report’s form, press the “Edit Report” button. Microsoft Word is started and the specified file is opened (or an empty file having the same name is created if the report form does not exist). For your convenience, the “Insert” window appears. Place the cursor in the desired area of the document form, select the desired table field from the field list and press the “Insert field” button. If it is necessary to insert the template for the subject table, just press the appropriate button. Be aware that using this button to insert a table results in:
 

@1 @2 @3 @4 @5

for the non-inverted table and:

@1
@2
@3

for the inverted one.

The template includes all fields of the table but no heading is created. To insert an inverted table it is necessary to select the parameter (“Invert”).
 

NOTE! Remember, Microsoft Word does not allow table to have more than 32 columns. Therefore, if you have used the “Insert table” button and the table has more than 32 columns, it will be inverted automatically.

Hint: When you invert a table, make sure you limit the number of records to a reasonable number, keeping in mind that a table can have no more than 32 columns!
 

If it becomes necessary to specify a heading for a table, or to include only a subset of the fields in the table, the table’s template should be created using the tools available in Microsoft Word.

To terminate the filling of the report form, press the “Close” button. Do not forget to save any changes made to the form! Word may then be closed, but it is not necessary.
 

Procedures following the definition of parameters

After specifying the parameter values, they must be saved by pressing the “Save parameters” button. If the parameters have been changed for testing purposes only, you can simply generate the report without saving.

To create a report using these parameters press the “Run report” button.

To close the report parameters’ input/editing form, press the “Exit” button. You will then be returned to the program’s main window.
 

Editing an existing report

Start Word Report Builder.

From the “Report” menu, select the item “Open” and then select the desired file with the extension REP (for example NAME.REP). This can also be performed by clicking the [button missing] button.

After changing parameter values, just save your changes with the “Save” button. (You can generate the report using the changed parameters without saving them).

To edit the report form, press the “Edit Report” button. To create a report based on the specified parameters, press the “Run report” button. To close the input/editing window, press the “Close” button. You will then be returned to the main program window. To switch from editing current report parameters to defining new ones, select the item “Clear  parameters” from the “Report” menu or press the [button missing] button.

Generating reports (Creating reports)

Using Command line mode

To create a report, type the command: WORDREP.EXE NAME.REP.

Where NAME.REP is the name of a parameter file created using Word Report Builder.

The report will be generated using the parameters stored in the file, NAME.REP.

If the output file for the report already exists, the new report will be appended to the end of the existing one. A message indicating termination will be displayed upon completion of the report.

Using Interactive mode

To operate the program in interactive mode, start Word Report Builder. From the “File” menu, choose “Open” and then select the desired file with the extension REP (For Example NAME.REP). This can also be performed by pressing the [button missing] button: .

After loading the parameter file, select “Run report” from the “Report” menu or press the [button missing] button. The report will be generated using the parameters stored in the REP file. If the report’s output file already exists, a file selection dialog box will be displayed offering you the options: “Add” the new report to the end of existing, “Replace” the existing report or “Cancel” creation of the report. A message indicating termination will be displayed upon completion of the report. You may then generate a report with new parameters or exit the program.