Introduction to Styled Reports

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 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.


Top of page

Example: Specifying Formatting for the Order Revenue Report

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, $
  1. Adds a page heading to the report.
  2. Reformats the order date from (for example) 2001/10/03 to Oct. 3, 01.
  3. Aligns the heading with the report(tm)s margins instead of the page(tm)s margins.
  4. Identifies a StyleSheet file to format the report.
  5. Increases spacing between report lines.
  6. Uses a proportional serif font for the report(tm)s data.
  7. Highlights each order that totals more than $500,000 by applying a navy font and an aqua background, and by bolding the order total.
  8. Uses a proportional sans serif font for the report(tm)s column titles.
  9. Formats the report(tm)s heading by centering it, applying a larger sans serif font, coloring most of it with a dark turquoise background and white lettering, and applying the inverse coloring to the page number (the sixth line of the heading).

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.


Top of page

x
Choosing a Type of Style Sheet

You can choose between two types of style sheets to format a report:

How do you choose between the two types of style sheets? Consider choosing:


Information Builders