Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
report_default_styles_and_behaviour [2015/03/22 11:14]
127.0.0.1
report_default_styles_and_behaviour [2018/05/04 21:40] (current)
Line 1: Line 1:
-===== Apply Defaults ​Styles And Behaviour ======+===== Apply Default ​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. 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 :-+This file allows you to set useful ​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. 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.
Line 12: Line 12:
 placing this in a project folder it will be used for all reports in that folder instead of the global one. placing this in a project folder it will be used for all reports in that folder instead of the global one.
  
 +
 +===== A note on fonts =====
 +
 +It is possible to set the font to use but given that the PDF and HTML mechanisms use a different source for fonts it is necessary to specify different style sets for the two formats.
 ===== Apply Styles ===== ===== Apply Styles =====
  
Line 39: Line 43:
             $reportico->​apply_styleset("​BODY",​ $styles, false, "​PDF"​);​             $reportico->​apply_styleset("​BODY",​ $styles, false, "​PDF"​);​
 </​code>​ </​code>​
 +
 +Note: because of the differences between HTML and PDF generation, in some cases styles applied in PDF may not behave the same as in HTML. For this reason it may be necessary to apply differet sets of styles for PDF and HTML. This will involve some experimentation.
 +
 +===== Page Headers and Footers =====
 +
 +Use the **create_page_header** and **create_page_footer** to add text and image elements to the top and bottom of each page. 
 +<​code>​
 +      $reportico->​create_page_header($name,​ $line, "​TEXT{STYLE styleinfo}"​ );
 +      $reportico->​set_page_header_attribute($name,​ "​ShowInHTML",​ "​no"​ );
 +      $reportico->​set_page_header_attribute($name,​ "​ShowInPDF",​ "​yes"​ );
 +      $reportico->​set_page_header_attribute($name,​ "​Justify",​ "​right|left|center"​ );
 +</​code>​
 +      ​
 +Where :-
 +name is a unique name to give to header
 +line is a line number from the top of the report page to display the header. This can be from 1 onwards. However you can use the margin styling option to more accurately control the space to leave before printing the header.
 +
 +The TEXT element can be freeform text or you can use the following notation to include other elements
 +{REPORT_TITLE} - shows the title of the current report.
 +{PAGE} - Shows the current page number
 +{columnname} - Shows the value of a the report row data column to be next printed
 +
 +For STYLE use CSS syntax:-
 +{STYLE border-width:​ 1 1 1 1; border-color:​ #000000; border-style:​ solid;​padding:​10px 14px 0px 6px;  width: 90%}
 +
 +Example to add a right justified report title in a blue 4 pixel border with a red background to the top of the page 2cm from th top :-
 +
 +<​code>​
 +           ​$reportico->​create_page_header("​H1",​ 1, "​{REPORT_TITLE}{STYLE border-width:​ 4px 4px 4px 4px; border-color:​ #0000ff; border-style:​ solid; margin: 2cm 0 0 0;" );
 +            $reportico->​set_page_header_attribute("​H1",​ "​ShowInHTML",​ "​no"​ );
 +            $reportico->​set_page_header_attribute("​H1",​ "​ShowInPDF",​ "​yes"​ );
 +            $reportico->​set_page_header_attribute("​H1",​ "​Justify",​ "​right"​ );
 +</​code>​
 +
 +For page footers do exactly the same using the create_page_footer and set_page_footer_attribute functions but the line number is relative to the bottom.
 +
  • report_default_styles_and_behaviour.1427022896.txt.gz
  • Last modified: 2018/05/04 21:38
  • (external edit)