Aligning a Heading or Footing Element Across Columns in an HTML or PDF Report

How to:

With HEADALIGN=BODY, each heading or footing element is aligned with a data column in an HTML or PDF report. With HEADALIGN=INTERNAL, each element is continued in a column of an HTML table created and aligned specifically for the report heading or footing. By default, every heading or footing element (ITEM) is placed in the first available column. However, you can position an item to span multiple columns using the COLSPAN attribute. For details about HEADALIGN options, see Aligning a Heading or Footing Element in an HTML, XLSX, EXL2K, or PDF Report.

You must specify the HEADALIGN and COLSPAN attributes in two separate StyleSheet declarations, since HEADALIGN applies to an entire heading or footing, while COLSPAN applies to a specific item in a heading or footing.


Top of page

x
Syntax: How to Align a Heading or Footing Element Across Columns in an HTML or PDF Report
TYPE = headfoot, [subtype,] COLSPAN = n, $

where:

headfoot

Is the type of heading or footing. Valid values are TABHEADING, TABFOOTING, HEADING, FOOTING, SUBHEAD, and SUBFOOT.

subtype

Are additional attributes that identify the report component. These options can be used separately or in combination, depending upon the degree of specificity required to identify an element. Valid values are:

  • LINE, which identifies a line by its position in a heading or footing. Identifying individual lines enables you to format each line differently.

    If a heading or footing has multiple lines and you apply a StyleSheet declaration that does not specify LINE, the declaration is applied to all lines. Blank lines are counted when interpreting the value of LINE.

  • OBJECT, which identifies an element in a heading or footing as a text string or field value. Valid values are TEXT or FIELD. TEXT may represent free text or a Dialogue Manager amper (&) variable.

    It is not necessary to specify OBJECT=TEXT unless you are styling both text strings and embedded fields in the same heading or footing.

  • ITEM, which identifies an item by its position in a line. To divide a heading or footing line into items, you can use the <+0> spot marker. For more information, see Identifying a Report Component in a WebFOCUS StyleSheet.

To determine the ITEM for an OBJECT, follow these guidelines:

  • When used with OBJECT=TEXT, count only the text strings from left to right.
  • When used with OBJECT=FIELD, count only values from left to right.
  • When used without OBJECT, count text strings and field values from left to right.

If you apply a StyleSheet declaration that specifies ITEM, the number is counted from the beginning of each line in the heading or footing, not just from the beginning of the first line.

COLSPAN
Is an attribute that aligns an item in the width spanned by multiple columns.
n
Is the column with which the specified item is aligned.


Example: Centering a Page Heading Across Three Columns

In this request, HEADALIGN=INTERNAL creates a three-column embedded HTML table for the heading. The COLSPAN attribute then centers the first line of the heading, Gotham Grinds, Inc., over the report, spanning the three columns in the embedded HTML table.

TABLE FILE GGORDER
HEADING
"Gotham Grinds, Inc."
" "
"Orders Report <+0> <+0> Run on: &DATE"
" "
PRINT ORDER_NUMBER ORDER_DATE STORE_CODE QUANTITY
BY PRODUCT_CODE BY PRODUCT_DESCRIPTION
IF RECORDLIMIT EQ 10
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE = REPORT, GRID = OFF, $
TYPE = HEADING, HEADALIGN = INTERNAL, $ 
TYPE = HEADING, LINE=1, COLSPAN=3, STYLE = BOLD, JUSTIFY=CENTER, $ 
TYPE = HEADING, LINE=3, ITEM=3, JUSTIFY=RIGHT, $
ENDSTYLE
END

The output is:



Example: Aligning a Field Value Across Multiple Columns

In this request, HEADALIGN=BODY aligns the sort footing in the same HTML table as the body of the report. COLSPAN = 5 positions the first item in the sort footing (the text Total) in the fifth column of the HTML table. The second item in the sort footing (the field <ST.QUANTITY) is positioned in the next available column.

The HEADALIGN attribute is on a separate line from the COLSPAN attribute because it applies to the entire sort footing (and consequently to both items), whereas COLSPAN applies to the single item Total.

TABLE FILE GGORDER
PRINT ORDER_NUMBER ORDER_DATE STORE_CODE QUANTITY
BY PRODUCT_CODE BY PRODUCT_DESCRIPTION
WHERE ORDER_DATE EQ '01/01/96'
WHERE STORE_CODE EQ 'R1019' 
ON PRODUCT_CODE SUBFOOT
"Total: <ST.QUANTITY" 
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE = REPORT, GRID = OFF, $ 
TYPE = SUBFOOT, HEADALIGN = BODY, JUSTIFY = RIGHT, STYLE = BOLD, $
TYPE = SUBFOOT, OBJECT = TEXT, COLSPAN = 5, $ 
ENDSTYLE
END

The partial output is:



Example: Aligning a Field Value Across Multiple Columns in a PDF Report

In this request, HEADALIGN=BODY aligns the sort footing in the same grid as the body of the report. COLSPAN=5 positions the first item in the sort footing (the text Total) in the fifth column of the report output. The second item in the sort footing (the field <ST.QUANTITY) is positioned in the next available column. The subfooting items are right justified.

The HEADALIGN attribute is on a separate line from the COLSPAN attribute because it applies to the entire sort footing (and consequently to both items), whereas COLSPAN applies only to the text item Total.

TABLE FILE GGORDER
PRINT ORDER_NUMBER ORDER_DATE STORE_CODE QUANTITY
BY PRODUCT_CODE BY PRODUCT_DESCRIPTION
WHERE ORDER_DATE EQ '01/01/96'
WHERE STORE_CODE EQ 'R1019'
ON PRODUCT_CODE SUBFOOT
"Total:<ST.QUANTITY"
""
ON TABLE SET PAGE-NUM OFF
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLESHEET *
TYPE=REPORT, FONT=ARIAL, SQUEEZE=ON,$ 
TYPE = SUBFOOT, HEADALIGN = BODY, JUSTIFY = RIGHT, STYLE = BOLD, $
TYPE = SUBFOOT, ITEM=1, COLSPAN = 5, $
ENDSTYLE
END

The output shows that the first item in the sort footing (the text Total) is in the fifth column of the report output. The second item in the sort footing (the field <ST.QUANTITY) is positioned in the next available column.


WebFOCUS