How to: |
Using StyleSheet attributes, you can enhance the appearance of a report by specifying a background color. You can designate background colors for a report as a whole, or for headings, footings, and columns individually.
Additionally, alternating backcolors (banded) can be specified for the background of the data lines in a report. These alternating colors are not supported for stacked columns (OVER, FOLD-LINE).
To specify a color for the background of a report, use the following syntax within a StyleSheet.
Note that when using BACKCOLOR in a PDF report, extra space is added to the top, bottom, right, and left of each cell of data in the report. This is for readability and to prevent truncation.
TYPE=type, [subtype,] BACKCOLOR={color|RGB({r g b|#hexcolor})}, $
where:
Is the report component you wish to affect, such as REPORT, HEADING, or TITLE. In a HEADING, FOOTING, SUBHEADING, or SUBFOOTING, you can specify a background color for individual elements.
Is any additional attribute, such as COLUMN, ACROSS, ITEM, that is needed to identify the report component that you are formatting. In a HEADING, FOOTING, SUBHEADING, or SUBFOOTING, you can specify a background color for individual elements. For more information about how to specify different report components, see Identifying a Report Component in a WebFOCUS StyleSheet.
Is the background color, which fills the space of the specified report component. The default value is NONE. If you are creating a report in HTML format, background colors will only appear in web browsers that support them.
Specifies the font color using a mixture of red, green, and blue.
(r g b) Is the desired intensity of red, green, and blue, respectively. The values are on a scale of 0 to 255, where 0 is the least intense and 255 is the most intense. Note that using the three color components in equal intensities results in shades of gray.
Is the hexadecimal value for the color. For example, FF0000 is the hexadecimal value for red. The hexadecimal digits can be in upper or lower case and must be preceded by a pound sign (#).
You can use color in a report to emphasize important information in a report. In the following report request, the data in the Dollar Sales column has been specified as RED on the condition that the Dollars value is less than 2,500,000. The background color is set to LIGHT BLUE:
TABLE FILE GGSALES ON TABLE SET PAGE-NUM OFF HEADING "Sales Report" SUM UNITS DOLLARS BY CATEGORY BY PRODUCT ON TABLE SET STYLE * TYPE=REPORT, BACKCOLOR=LIGHT BLUE, $ TYPE=DATA, COLUMN=DOLLARS, COLOR=RED, WHEN=DOLLARS LT 2500000, $ TYPE=REPORT, GRID=OFF, $ TYPE=HEADING, JUSTIFY=CENTER, SIZE=12,$ ENDSTYLE END
The output is:
To specify alternating colors for the background of the data in a report, use the following syntax within a StyleSheet.
Note that when using BACKCOLOR in a PDF report, extra space is added to the top, bottom, right, and left of each cell of data in the report. This is for readability and to prevent truncation.
TYPE=DATA,BACKCOLOR=({c1|RGB({r1 g1 b1|#hc1})} {c2|RGB({r2 g2 b2|#hc2})}),$
where:
(r g b) Is the desired intensity of red, green, and blue, respectively. The values are on a scale of 0 to 255, where 0 is the least intense and 255 is the most intense. Note that using the three color components in equal intensities results in shades of gray.
The following request against the GGSALES data source produces alternating light blue and white data rows on the report output:
TABLE FILE GGSALES ON TABLE SET PAGE-NUM OFF HEADING "Sales Report" SUM UNITS DOLLARS BY CATEGORY BY PRODUCT ON TABLE PCHOLD FORMAT HTML ON TABLE SET STYLE * TYPE=REPORT, GRID=OFF, $ TYPE=DATA, BACKCOLOR=('LIGHT BLUE' WHITE),$ TYPE=HEADING, JUSTIFY=CENTER, SIZE=12,$ ENDSTYLE END
The output is: