DGL Statement Reference : TABLE

TABLE

Description
Creates a simple table to be included in your document. You specify the number of columns and their widths, and the information to be included in the table in the statement parameters.
Syntax
stm_table_simple (title, columns, contents, page_width, page_height [, anchor]);
Parameters
:
A list of integers that specifies the width of each column, in number of characters. For example, {16} & {16} & {20} specifies a table having three columns, the first two columns being 16 characters wide and the last column being 20 characters wide.
A list of strings that contain the information to be entered into each cell of the table. The Documentor fills the table horizontally, row by row, depending on how many columns were specified.
{’Project Name’} & {’Date’} & {’Location’} & {’Alpha’} &{’April 2004’} & {’Boston’}
Specifies the width of the page, in inches. This parameter is relevant for Interleaf only—for other systems, specify 0.0 for this parameter.

 

page_height

Specifies the height of the page, in inches. This parameter is relevant for Interleaf only—for other systems, specify 0.0 for this parameter.

anchor

This parameter is relevant for Interleaf only. For formatters other than Interleaf, precede the table with your system’s “no fill” and “no adjust formatting” commands.

For Interleaf, this parameter is a character string that indicates where to place the table. The possible values are as follows:

A—At the anchor.

F—Following the anchor. This is the default value.

Example 1
This example produces a table named “Table-1”, where the page is 6 inches wide and 9.5 inches long. The column widths are determined by the list held in the integer list variable col_list, and the cell contents are held in the string list variable cell_list.

stm_table_simple (’Table-1’, col_list, cell_list,
6.0, 9.5);

Example 2
The following example shows how to generate a table using function calls. Note that in the example, new values are repeatedly assigned to the List_str variable to build the table.
The first statement uses the nroff commands for no fill (.nf) and no adjust (.na). These commands cause the word processor to take the text “as-is.” Some word processors see this mode as verbatim or literal. The last statement uses the nroff commands .fi and .ad to return to fill and adjust modes.

WRITE (’\n.nf \n.na \n’);

BEGIN
List_str:= {’ACTIVITY NAME’} & {’ID’} & {’LANGUAGE’};‘
act_list:=stm_r_ac_logical_desc_of_ac({act_chart},st);
FOR act IN act_list LOOP
List_str:=List_str & {stm_r_ac_name (act, st)};

attr_list:=stm_r_ac_attr_val (act, ’ID_NUMBER’, st);

IF (st = stm_success) THEN
attr_val:=stm_list_first_element (attr_list, st);
List_str:=List_str & {attr_val};
ELSE
List_str:=List_str & { ’N/A’};
END IF;

attr_list:=stm_r_ac_attr_val(act, ’LANGUAGE’, st);
IF (st = stm_success) THEN
attr_val:=stm_list_first_element (attr_list, st);
List_str:=List_str & {attr_val};
ELSE
List_str:=List_str & {’N/A’};
END IF;
END LOOP;

WRITE (’\n.nf\n.na\n’);
title := ’Table CC1. Simple Table Example’;
Col_list := {16} & {10} & {40};
stm_table_simple(title, Col_list, List_str, pg_w, pg_h,
’A’);
WRITE (’\n.fi\n.ad\n’);
END;

The formatted output is as follows:

 
See Also