This is an old revision of the document!

Apply Defaults Styles And Behaviour

As of 4.3, Reportico provides the reportico_defaults.php file to allow to set attributes, styles, formatting options, and other functions which will be applied to every report. This can be set up to apply to all reports, or all reports in a single project.

This file allows you to set usefule default behaviour including :-

Setting default styles to different areas of the report such as setting default colors, borders, margins, paddings etc. These can be applied to the report body, and most of the elements within the report such as group headers/trailers, detail block and individual cells. At the moment most styling options can be applied to both PDF and HTML format.

Adding Page Headers/Page Footers to every page (PDF Only). You can add styled coloured bordered text and image areas to allow you format the page title, page count, other custom text as well as adding images to your report pages.

The Reportico folder contains reportico_defaults.php which is a stub for entering such functions. By placing this in a project folder it will be used for all reports in that folder instead of the global one.

Apply Styles

In the reportico_defaults.php file you need to add a section for each element you want to style by default.

To add a style you need to create an array of style elements specified as key value pairs which are much like CSS.

Then you use the apply_styleset function to indicate which area of the reports should be styled and also specify whether the style should be applied to HTML output, PDF output or both as follows :-

  $reportico->apply_styleset($section, $styles, $cell, $outputformat);

where :-

  • styles is the array of styles
  • cell is set to a columnname to apply the styles to (for CELL section only) otherwise set to false
  • outputformat is the output format type to apply the style to .. set to PDF, HTML or leave blank to apply to both

For example to apply a background color and set a border to the whole report body in PDF format :-

            $styles = array(
                "background-color" => "#cccccc",
                "border-width" => "1px 1px 1px 1px",
                "border-style" => "solid",
                "border-color" => "#000000",
                "margin" => 
            $reportico->apply_styleset("BODY", $styles, false, "PDF");
  • report_default_styles_and_behaviour.1427022896.txt.gz
  • Last modified: 2018/05/04 21:38
  • (external edit)