Linking to an External Cascading Style Sheet

How to:

To format a report using an external cascading style sheet (CSS), you must link to the cascading style sheet by assigning a file location using the CSSURL attribute or parameter:

When the CSSURL is specified in several ways, the most local specification takes precedence. The order of precedence, from local (1) to global (3), is:

1. TYPE=REPORT, CSSURL = url_or_fully-qualified pathname
2. ON TABLE SET CSSURL url_or_fully-qualified pathname
3. SET CSSURL = url_or_fully-qualified pathname

Syntax: How to Use the CSSURL SET Parameter to Link to an External CSS

To link an external cascading style sheet (CSS) to a report using a SET parameter, issue the following command in a procedure:

SET CSSURL = css_url_or_fully-qualified pathname

or the following ON TABLE SET command in a report request:

ON TABLE SET CSSURL css_url_or_fully-qualified pathname

where:

css_url_or_fully-qualified pathname

Is the location of the external cascading style sheet (assume it is case-sensitive).

The length limit is:

  • 69 characters in a SET command.
  • 57 characters in an ON TABLE SET command.

Example: Linking to an External cascading style sheet Using the CSSURL Attribute

This report displaying products offered by Gotham Grinds is formatted using an external cascading style sheet (CSS) that is linked through the CSSURL attribute in the FOCUS StyleSheet:

TABLE FILE GGPRODS
HEADING
"</1 Current Products</1"
PRINT PRODUCT_DESCRIPTION UNIT_PRICE
BY PRODUCT_ID
ON TABLE SET PAGE-NUM OFF
ON TABLE HOLD AS CSSEXAM3 FORMAT HTML
 
ON TABLE SET STYLESHEET * 
TYPE=REPORT, CSSURL = c:\projects\report01.css, $ 
TYPE=HEADING, CLASS=headText, $
TYPE=TITLE, CLASS=reportTitles, $
TYPE=DATA, CLASS=lowCost, WHEN=N3 LT 27, $
ENDSTYLE
END

The output is:



Syntax: How to Use the CSSURL Attribute to Link to an External CSS

Use the following syntax to link an external cascading style sheet (CSS) to your report using a FOCUS StyleSheet attribute:

[TYPE=REPORT,] CSSURL=css_path, $

where:

TYPE=REPORT

Specifies that this attribute is being applied to the entire report. If it is omitted, the StyleSheet declaration still defaults to this setting.

css_path

Specifies the URL or fully-qualified path name of the location where the external cascading style sheet definition file resides.

If you specify CSSURL multiple times, the last value specified in an ON TABLE SET command overrides all the other values within that report request. If CSSURL is not specified within a report request, the last value specified with SET overrides all the others.


Information Builders