In this section: |
A StyleSheet describes how you want your report to look. You can create a StyleSheet within a report request or as a separate file. Either way, it consists of a series of declarations. Each declaration identifies a report component whose characteristics you wish to define (such as a heading, column, or grand total) and describes the desired characteristics of that component.
For HTML reports, you can also use external cascading style sheets and enable internal cascading style sheets. For details, see Cascading Style Sheets.
Unless otherwise noted, all StyleSheet references in this document refer to FOCUS StyleSheets.
Style sheets enable you to create extremely detailed formats for every line, column, or value in your report. In most cases, you will want to use the formatting facilities judiciously to make important information stand out. FOCUS has its own StyleSheets and also supports cascading style sheets for HTML reports, as described in Cascading Style Sheets.
For some types of formatting you can choose between using a style sheet or report syntax. Style sheets enable you to centralize and reuse formatting logic. This provides you with several advantages:
You can apply several formatting techniques to save yourself time and effort. Most of these techniques enable you to use code provided for you by FOCUS, or to leverage code that you write yourself:
For example, if you declare all the report's data to be blue, all data in all columns will be displayed as blue; if you also declare all vertical sort (BY) columns to be orange, this will override the blue for sort columns, which will be displayed as orange; and if you also declare the EMP_ID sort column green, this will override the orange and be displayed as green. For more information, see FOCUS StyleSheet Attribute Inheritance.
For example, if there are several parts of a report that you wish to emphasize (such as titles of important columns, data values that exceed a threshold, and sort headings), and you want all of these to be bold and purple, you can define a macro that sets font style to bold and color to purple, and then apply the macro to all of these report components.
This report displays the order number, order date, and total order revenue for Century Corporation for the third quarter of 2001:
The report is formatted by a FOCUS StyleSheet and by formatting commands in the report procedure itself. The procedure is shown below, followed by the StyleSheet file, OrderRev:
TABLE FILE CENTORD 1.HEADING 1. " " 1. "C e n t u r y C o r p o r a t I o n" 1. " " 1. "Order Revenue - 2001 Q3" 1. " " 1. "page <TABPAGENO" 1. " " 2. SUM ORDER_DATE/MtDY ORDER_NUM LINEPRICE AS 'Order,Total:' BY LOWEST 9 ORDER_DATE NOPRINT WHERE (ORDER_DATE GE '2000/10/01') AND (ORDER_DATE LE '2000/12/31'); 3. ON TABLE SET SQUEEZE ON 4. ON TABLE SET STYLESHEET OrderRev ON TABLE HOLD FORMAT PDF END
OrderRev Style Sheet
5. TYPE=Report, GRID=Off, UNITS=Inches, TOPGAP=0.06, BOTTOMGAP=0.06, $ 6. TYPE=Data, FONT='Times', $ 7. TYPE=Data, BACKCOLOR=Aqua, COLOR=Navy, 7. WHEN=LinePrice GT 500000, $ 7. TYPE=Data, COLUMN=LINEPRICE, BACKCOLOR=Aqua, COLOR=Navy, STYLE=Bold, 7. WHEN=LinePrice GT 500000, $ 8. TYPE=Title, FONT='Helvetica', $ 9. TYPE=Heading, FONT='Helvetica', STYLE=Bold, SIZE=14, JUSTIFY=Center, 9. BACKCOLOR=Dark Turquoise, COLOR=White, $ 9. TYPE=Heading, LINE=6, BACKCOLOR=White, COLOR=Dark Turquoise, $ 9. TYPE=Heading, LINE=7, BACKCOLOR=White, $
This is only a summary of what these formatting instructions do; you can find complete explanations in the topics that describe each formatting feature.
The formatting logic that you apply to your own reports may be briefer or more extensive than this example, depending on the report and on what formatting you choose to apply.
You can choose between two types of style sheets to format a report:
If you are generating a report in HTML format, you can boost its performance, and increase the number of formatting options available to it, by having the FOCUS StyleSheet dynamically generate an internal cascading style sheet (CSS). (CSS is the standard style sheet language designed for HTML documents; the internal CSS generated by FOCUS is internal to the report output, instead of being saved as a separate file.)
How do you choose between the two types of style sheets? Consider choosing:
Information Builders |