In generating worksheets, TABLEXLS would generally create a single row of column headers for each worksheet.
The text for the column headers is retrieved from the File-Field descriptions related to the processed database file.
Though this is generally acceptable, there may be cases where one would need to have different text descriptions in some column headings
or even extend the headings over more rows.
In command TABLEXLS you may use parameter ALTCOLHDG to replace the default column headings with your own headings.
This can be done by specifying in this parameter the path-name of a stream file where the heading rows are defined in XLSGEN language.
The following example explains how this can be done.
In this example we use database file HSSFCGIDTA/ADHOCCTL: that is a control file available on your system after installing HSSFCGI.
We use this file because you can repeat this example on your IBMi.
Let us run the following command:
TABLEXLS FROMFILE(HSSFCGIDTA/ADHOCCTL) TOXML('/tmp/adhocctl.txt')
The resulting worksheet looks like this:
Let us have a look at the XLSGEN script generated by that command TABLEXLS
(the XLSGEN script is then used by command TABLEXLS to feed command XLSGEN, which creates the XLS).
That XLSGEN script is in stream file /tmp/adhocctl.txt (See Figure 2).
The part of the script that generates the column headings is the one inside the red rectangle.
If we want different headings from the default ones generated by TABLEXLS,
we must write in a stream file our XLSGEN tags, and mention that stream file in parameter
ALTCOLHDG of command TABLEXLS.
Figure 3 shows the XLSGEN script that we would like to use for generating the column headers of the worksheet.
Let us assume that we wrote this script in stream file /hssfcgi/altcolhdg/adhocctl.txt.
Let us now run the following command:
The resulting worksheet id shown in Figure 4.
- The XLGEN script stream file mentioned in parameter ALTCOLHDG applies only to the members of the first database file in parameter FROMFILE.
For the other database file members, column headings are retrieved from the related file-field descriptions.