HTML Report Template Customisation in PowerINSPECT 4.0

PWI000109

Context

this document applies to :

  1. PowerINSPECT 4.0

Gripe no 0000

Summary

PowerINSPECT 4.0 is able to generate and store results in HTML format but still has the ability to generate the report using Excel. The HTML procedure uses a template to format the output. The installation of PowerINSPECT 4.0 installs a number of pre-defined templates which have been based on the Excel templates in previous versions of PowerINSPECT. With a little knowledge of HTML, the user is able to edit or change the format to suit their own requirements.

Description

For Excel report the concept of a template for the report was equal to the concept of a file. In the other words all the information that was needed for a report was kept in one file that was called the Excel report template. The concept of a report template for HTML reporting is different. A template is a set of files. This set is usually saved in a separate folder. It can be seen in the current implementation of HTML report and the folders like "Delcam2003" and "WebLike". By default it is assumed that there are at least three files in a template folder for example in folder Delcam2003: '''Delcam2003.pxm''', '''Layout.html''' and '''Styles.css'''. The template folder may also contain any additional files (mainly the image files) that are used in the report. 

What information is stored inside the files that make an HTML report template?

Consider files in the folder Delcam2003:

Delcam2003.pxm  is the main file for the template. This file is in XML format. It stores the configuration information that creates a report using the templates you choose. The root element of the file is the "Report" tag. It has children. Each child tag name is mapped to an element in the report, e.g. the child


<Header ....>
    <....>
</Header>


is mapped to the report header that is placed at the very beginning of each report. By setting the attributes and adding sub-children you can rule how an element is displayed, e.g. by changing the '''TemplateID''' attribute you can choose which template is selected for the given element.

Layout.html: This file contains information about the layout of the elements of a report. This file is in HTML format. Each element is marked with an  "id"  tag. The value of the tag is related to the value of a  "TemplateID"  attribute. When they match, the given HTML element will be used for the corresponding item as configured in Delcam2003.pxm. The HTML elements usually contain sub-elements. These sub-elements in turn contain other sub-elements and so on. This hierarchy creates a layout.

The "id"  tag of the HTML elements can be used for several purposes.


Note: Make sure that the only and pure layout information is stored in the Layout.html. If you want to change something that can be done with CSS (font, size, margins, borders, colours and so on), please use the Styles.css file and keep the Layout.html tidy.

Styles.css: This file contains definitions of the styles that are used in the report. It should be used each time you want to alter the layout details that can be altered with CSS.
 

How information from a template is used

When creating a report the sequence tree is travelled from the top to the bottom. For each element in the sequence tree (including groups that are treated as an element) the report engine finds a child node in the Delcam2003.pxm file. If the node is found then the "TemplateID" attribute is got. If it is found, then the Layout.html file is searched for an HTML object which has the same  "id" attribute. If it is found the HTML object is copied to the report with all the objects that it includes. If an element from the sequence tree requires some sub-elements to be put inside (for example a geometry group requires the geometry items to be put inside it in a report) then the HTML object is searched for an element with the "id" attribute equal to ''idContent'' and all the sub-elements are added inside this element.

If at any point the report engine cannot find an HTML object it takes one from the default file which is LayoutDefault.html which is kept in the folder HTMLScripting.

The Layout.html and the LayoutDefault.html use Cascading Style Sheets classes in order to customise appearance of the report. The classes used in the LayoutDefault.html are defined in the StylesDefault.css files. The classes defined in the Layout.html should be defined in the Styles.css file inside a template. The classes from the current template are applied after the default classes, so if you need to change the default class just re-define it in your Styles.css for the template you are working on and do not change the StylesDefault.css.

The default layout file and the default CSS file.

The LayoutDefault.html and the StylesDefault.css files contain the default layout and the default css classes for HTML report. Those files are supported by developers and generally should not be used for customization. In the further versions of the report engine those classes may be included in the source code and will not be shipped separately as they are now. All customization should be possible using the files from a template. The default files can be altered when we find a bit in report layout that is likely to be the same for all the templates we create.


Note: If any element cannot be customized from the template, and you need to change the default files, it should be considered as a bug and reported through the normal channels.


The default layout and css files serve two needs. Firstly they allow to make sure that any new element from the sequence tree has at least one template. Secondly they accumulate all the design solutions that are likely to be used in all the templates eliminating therefore the need to repeat those design solutions in the actual templates.
 

Changing the Logo

If the logo needs to be changed, there are two methods that can be used. This explanation will use the files in the Delcam2003 folder.


Generating Report of Single Points (Retrace Points) in Tabulated Format

By default, the reporting of Single Points will be in geometric format. If the report is required in a tabulated format as for surface points, then a different template will need to be used. This template is accessed from the TemplatePerItem folder. In this folder, select the file TemplatePerItem.pxm to generate the results for Single Points in tabulated format. To keep the output generated neat, the Single Points sequences are better kept in their own Geometric Group.