Positioning a Report Component

How to:

Reference:

A StyleSheet enables you to specify an absolute or relative starting position for a column, heading, or footing, or element in a heading or footing. You can also add blank space around a report component.

For a PDF, PS, or HTML report, you can use the POSITION attribute in a StyleSheet to specify a starting position for a heading or footing, expressed as a unit measurement. For HTML, this capability requires an internal cascading style sheet. For details on selecting an alignment method, see Aligning Heading and Footing Elements.

In addition, for a PDF or PS report, you can use the POSITION attribute to specify an absolute or relative starting position for an element within a heading or footing, or to align an item in a heading or footing with a report column. An absolute starting position is the distance from the left margin of the report. A relative starting position is the distance from the preceding object. For the first item on a heading line this is the left margin of the report.

In an HTML report, you can use related syntax and an internal Cascading StyleSheet to position an image in a heading or footing.


Top of page

x
Reference: Positioning Attributes

Attribute

Description

Applies to

POSITION

Sets absolute or relative starting position of a column.

An absolute position is the distance from the left margin of the printed paper.

A relative position is the distance from the default position. After the first column, the default position is the end of the preceding column.

PDF

PS

TOPGAP
BOTTOMGAP

Adds blank space to the top or bottom of a report line.

PDF

PS

LEFTGAP
RIGHTGAP

Adds blank space to the left or right of a report column.

PDF

PS


Top of page

x
Syntax: How to Specify the Starting Position of a Column

This syntax applies to a PDF or PS report.

TYPE=REPORT, COLUMN=identifier, POSITION={+|-}position, $

where:

identifier

Selects a single column and collectively positions the column title, data, and totals if applicable. For valid values, see Identifying an Entire Report, Column, or Row.

+

Starts the column at the specified distance to the right of the default starting position.

By default, text items and alphanumeric fields are left-justified in a column, and numeric fields are right-justified in a column.

-

Starts the column at the specified distance to the left of the default starting position.

It is possible to create a report in which columns overlap. If this occurs, simply adjust the values.

position

Is the desired distance, in the unit of measurement specified with the UNITS attribute.


Top of page

x
Syntax: How to Set a Starting Position for a Heading or Footing

Use the following syntax to specify a starting position for an entire heading or footing in relation to the left margin of a report.

TYPE = headfoot, POSITION = position, $

where:

headfoot

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

position

Is the desired distance from the left, expressed by the UNITS attribute (the default is INCHES).

Note: In an HTML report, this syntax must be used in conjunction with an internal cascading style sheet.


Top of page

x
Syntax: How to Set a Starting Position for a Heading or Footing Element

For a PDF or PS report, use the following syntax to specify a starting position for a heading or footing element in relation to the preceding item

TYPE = headfoot, [subtype,] POSITION = {+|-}option, $

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 you need to fully 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.

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.

To determine an ITEM number 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.

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.

option

Is the alignment method. Valid values are:

position which is the desired distance, expressed by the UNITS attribute (the default is inches) for absolute positioning.

+ which starts the heading or footing element at the specified distance to the right of the preceding item. For the first item in a heading or footing, the preceding item is the left margin of the report.

- which starts the heading or footing element at the specified distance to the left of the preceding item. This is useful if you want to overlap images in a heading.

column_title which aligns the heading or footing element with the first character of the designated column.



Example: Specifying an Absolute Starting Position for a Column

The following illustrates how to position a column in a printed report. The request specifies that the PRODUCT_DESCRIPTION field should appear three inches from the left margin of the PDF report.

TABLE FILE GGORDER
"PRODUCTS ORDERED ON 08/01/96"
SUM QUANTITY BY PRODUCT_DESCRIPTION
WHERE ORDER_DATE EQ '080196'
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD FORMAT PDF
ON TABLE SET STYLE * 
TYPE=REPORT, COLUMN=PRODUCT_DESCRIPTION, POSITION=3, $ 
ENDSTYLE
END

The output is:



Example: Specifying a Relative Starting Position for a Column

This request positions the column title and data for the QUANTITY field two inches from the default position; in this case, two inches from the end of the preceding column.

TABLE FILE GGORDER
"PRODUCTS ORDERED ON 08/01/96"
SUM QUANTITY BY PRODUCT_DESCRIPTION
WHERE ORDER_DATE EQ '080196'
ON TABLE SET PAGE-NUM OFF 
ON TABLE HOLD FORMAT PDF 
ON TABLE SET STYLE *
TYPE=REPORT, COLUMN=PRODUCT_DESCRIPTION, POSITION=3, $ 
TYPE=REPORT, COLUMN=QUANTITY, POSITION=+2, $ 
ENDSTYLE
END

QUANTITY, titled Ordered Units in the report, is relatively positioned to Product:



Example: Setting an Absolute Starting Position for a Heading Item

This request uses the spot marker <+0> to divide the report heading into three text strings. It starts the third text string, 1st Qtr 2001, 3 inches from the left report margin. This technique can be used in PDF as well as PS reports.

TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE SUBHEAD 
"Sales Report - <+0>All Products<+0> 1st Qtr 2001" 
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE SET SQUEEZE ON
ON TABLE HOLD FORMAT PDF
ON TABLE SET STYLESHEET * 
TYPE = TABHEADING, OBJECT = TEXT, ITEM=1, SIZE = 12, STYLE = BOLD, $
TYPE = TABHEADING, OBJECT = TEXT, ITEM=2, STYLE = BOLD, $
TYPE = TABHEADING, OBJECT = TEXT, ITEM=3, POSITION = 3, $ 
ENDSTYLE
END

The output is:



Example: Setting a Relative Starting Position for a Heading Item

This request uses the spot marker <+0> to divide the report heading into three text strings. It starts the third text string, 1st Qtr 2001, one inch to the right of the previous item on the heading line. Inches are the default unit of measure. This technique can be used in PDF as well as PS reports.

TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE SUBHEAD 
"Sales Report - <+0>All Products<+0> 1st Qtr 2001" 
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE SET SQUEEZE ON
ON TABLE HOLD FORMAT PDF
ON TABLE SET STYLESHEET * 
TYPE = TABHEADING, OBJECT = TEXT, ITEM=1, SIZE = 12, STYLE = BOLD, $
TYPE = TABHEADING, OBJECT = TEXT, ITEM=2, STYLE = BOLD, $
TYPE = TABHEADING, OBJECT = TEXT, ITEM=3, POSITION = +1, $ 
ENDSTYLE
END

The output is:



Example: Aligning a Heading Item With a Column

This request uses the spot marker <+0> to divide the report heading into three text strings. It starts the second text string at the horizontal position where the column UNITS (Unit Sales) is. This technique can be used in PDF as well as PS reports.

TABLE FILE GGSALES
SUM UNITS DOLLARS BY CATEGORY BY PRODUCT
ON TABLE SUBHEAD 
"Sales Report - <+0>All Products<+0> 1st Qtr 2001" 
" "
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD FORMAT PDF
ON TABLE SET SQUEEZE ON
ON TABLE SET STYLESHEET * 
TYPE = TABHEADING, LINE=1, ITEM=2, POSITION=UNITS, $ 
ENDSTYLE
END

The output is:

You can employ several types of spot markers to refine the positioning of headings and footings, and elements within them, in HTML and PDF reports that use proportional fonts. For maximum control, you can combine spot markers with other alignment techniques.

You can also use spot markers to position heading and footing elements at fixed and relative column locations. Several spot markers control positioning based on the pre-defined width of a character in a monospace font. This formatting technique is not supported for proportional fonts.


Top of page

x
Syntax: How to Add Blank Space Around a Report Component

In a PDF or PostScript report, you can add space around report components.

Use the TOPGAP and BOTTOMGAP attributes to control spacing between heading or footing lines, and between heading or footing text and the grid lines above and below them.

Note: You can use TOPGAP and BOTTOMGAP with multi-line headings. Keep in mind that between heading lines, the top and bottom gap will be inserted, making the spacing between lines greater than the spacing at the top and bottom of the heading.

TYPE=headfoot, {TOPGAP|BOTTOMGAP}=gap, $
TYPE=REPORT, {TOPGAP|BOTTOMGAP}=gap, $
  TYPE=type, [COLUMN=identifier,|ACROSSCOLUMN=acrosscolumn,]
 {LEFTGAP|RIGHTGAP}=gap, $

where:

TOPGAP

Indicates how much space to add above the report line.

BOTTOMGAP

Indicates how much space to add below the report line.

gap

Is the amount of blank space, in the unit of measurement specified with the UNITS attribute.

In the absence of grids or background color, the default value is 0. For RIGHTGAP, the default value is proportional to the size of the text font.

In the presence of grids or background color, the default value increases to provide space between the grid and the text or to extend the color beyond the text.

The gaps must be the same within a single column or row. That is, you cannot specify different left or right gaps for individual cells in the same column, or different top and bottom gaps for individual cells in the same row.

type

Identifies the report component. For valid values, see Identifying Report Components.

identifier

Selects one or more columns using the COLUMN attribute described in Identifying an Entire Report, Column, or Row.

acrosscolumn

Selects the same column under each occurrence of an ACROSS sort field, using the ACROSSCOLUMN attribute described in Identifying an Entire Report, Column, or Row.

LEFTGAP

Indicates how much space to add to the left of a report column.

RIGHTGAP

Indicates how much space to add to the right of a report column.

Note: For TOPGAP, BOTTOMGAP, LEFTGAP, and RIGHT GAP, you must specify a value of at least 0.013889 (the decimal size of a point in inches). If you specify a value less than this, FOCUS will round down to the nearest point, which is zero.



Example: Adding Blank Space Above Data Values

This request generates one-tenth of an inch of blank space above every data value in a PDF report.

SET PAGE-NUM = OFF
TABLE FILE GGORDER
"PRODUCTS ORDERED ON 08/01/96"
" "
SUM QUANTITY BY PRODUCT_DESCRIPTION
WHERE ORDER_DATE EQ '080196'
ON TABLE HOLD FORMAT PDF
ON TABLE SET STYLE * 
TYPE=DATA, TOPGAP = 0.1, $ 
ENDSTYLE
END

The data is spaced for readability:



Example: Adding Blank Space to Separate Heading Text From Grid Lines in a PDF Report

This request generates a PDF report with blank space added above and below the report heading to separate the text from the upper and lower grid lines. The space above is added by the TOPGAP attribute; the space below is added by the BOTTOMGAP attribute.

TABLE FILE GGSALES
SUM BUDUNITS UNITS BUDDOLLARS DOLLARS
BY CATEGORY
ON TABLE SUBHEAD
"SALES REPORT <+0>December 2001"
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD FORMAT PDF
ON TABLE SET SQUEEZE ON
ON TABLE SET STYLESHEET *
TYPE = TABHEADING, GRID=ON, JUSTIFY=CENTER, TOPGAP=.25, BOTTOMGAP=.25, $
TYPE = TABHEADING,  FONT='TIMES', SIZE=12, STYLE=BOLD, $
TYPE = TABHEADING, ITEM=2, SIZE=10, STYLE=ITALIC, $
ENDSTYLE
END

The output is:


Information Builders