In this section: |
To format a report using an external cascading style sheet (CSS), you can:
How to: |
You can apply external cascading style sheet (CSS) formatting to:
When using an external cascading style sheet to format a report, it is recommended not to use a FOCUS StyleSheet to specify the report's formatting unless you also generate an internal cascading style sheet.
To apply an external cascading style sheet (CSS) class to a report component, use the following syntax in a FOCUS StyleSheet declaration.
TYPE = type, [subtype,] CLASS = classname, [when,] [link,] $
where:
Identifies the report component to which you are applying the class's formatting. For tabular and free-form reports, it can be any component.
Each report component can be formatted by one class. If you specify several classes for a report component:
Is an optional attribute and value needed to specify certain kinds of report components completely. For example, COLUMN and a column identifier are needed to specify a particular report column.
Is the name of the cascading style sheet class you are applying to format the report component. You can assign the same class to multiple report components.
Class names are case sensitive, and must agree with the case name in the class rule in the cascading style sheet. (Note, however, that not all Web browsers enforce case sensitivity for class names.)
Is an optional WHEN attribute and value. Supply this to apply conditional formatting.
Is an optional URL or JAVASCRIPT attribute and value. Supply this if you want to link the report component to another resource.
How to: |
Three items are required to style a report with an external cascading style sheet (CSS):
This example demonstrates the interaction.
To format a report using an external cascading style sheet (CSS):
.ColumnTitle {font-family:helvetica; font-weight:bold; color:blue;}
TD {font-family:helvetica}
Because this rule is for the TD element, the formatting is applied to an entire report, not just a report component.
TYPE=AcrossValue, CLASS=ColumnTitle, $
You can accomplish the same thing using a SET command:
This annotated report, which displays products currently offered by Gotham Grinds, is formatted using a cascading style sheet (report01.css). The formatting specifies that:
The style sheet formatting overrides the report heading default font family of Times New Roman. The heading is also in a larger point size and is center-justified.
The report request and inline FOCUS StyleSheet follow:
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 CSSEXAM2 FORMAT HTML 1. ON TABLE SET STYLE * 2. TYPE=REPORT, CSSURL=c:\Projects\report01.css, $ 3. TYPE=HEADING, CLASS=headText, $ 4. TYPE=TITLE, CLASS=reportTitles, $ 5. TYPE=DATA, CLASS=lowCost, WHEN=N3 LT 27, $ 6. ENDSTYLE END
The external cascading style sheet, report01.css, follows:
7. BODY {font-family:Arial, sans-serif} 8. TABLE {border:0} 8. TD {border:0} 9. .reportTitles {font-weight:bolder; background:lightblue;} 10..lowCost {color:green; font-style:italic;} 11..headText {font-family:Times New Roman, serif; font-size:larger; text-align:center}
Because this is a rule for BODY, it is applied to the entire report: all text in the report defaults to Arial. You can override this for a particular report component by applying a rule for a generic class to that component, as is done in this procedure with the rule for the headText class (see line 11).
The FOCUS StyleSheet applies this rule to the report(tm)s heading. It overrides the default font family specified in the rule for the BODY element (see line 7).
The output is:
|
Information Builders |