Elastic Report Plugin
Elastic Report Plugin allows to generate reports according to a custom configuration. Using this plugin, you can build almost any desired report. A user simply selects the period and clicks the generate report button. Report configurations are created by an administrator. Download the plugin using the link.
Elastic Report Plugin is installed according to the instructions. During installation, complete the following additional step: copy the
PlgElasticReport.xml file from the plugin distribution into your project. The file should be displayed in the project explorer under the Webstation > Configuration Files node.
A report consists of a set of sections, which are listed in the output document, one by one. Each section has its own type, parameters, and data binding. In addition, the report has the general parameters that affect all sections. The same report can be generated in a variety of formats. Currently supported PDF, Excel and HTML formats. The appearance of the same report, generated in different formats may slightly differ.
Each report form requires the creation of a separate configuration file in XML format. The configuration file specifies the report formatting and determines the binding of report data to channels. This file should be saved in the views directory or a subdirectory within the project.
Configuration files may be edited using any text editor. For example, the free editor Notepad++ is convenient for working with XML files.
An example report file
ElasticReport1.xml is contained in the plugin installation package. This example includes a detailed description of the options and demonstrates the generation of report sections of all possible types.
The main elements of the report configuration file:
InputOptionselement contains options for the input report form, with which a user enters the report parameters and starts generating the document.
OutputOptionselement contains formatting options for the generated document.
Documentelement defines the content of the report.
DocumentOptionselement specifies basic options that apply to the entire document.
Sectionelement describes a report section containing data. A report includes one or more sections of various types.
The supported section types:
TimeDatasection displays channel data for the selected time period. Channels are displayed horizontally, timestamps are displayed vertically.
TimeTimesection displays data of one channel in a compact form. Timestamps are displayed in the horizontal and vertical section headers.
DataDatasection displays data in a table form. Each cell can be linked to its own channel.
The plugin provides the generation of reports based on historical data. Reports on current data and events are not supported. When choosing a historical archive for a report, it is recommended to give preference to an archive with a data writing period that matches or is close to the step of the report sections. This will avoid fetching unnecessary data.
PlgElasticReport.xml configuration file contains a list of reports divided into groups, which are displayed on the Main Menu > Reports page. Example of file contents:
<?xml version="1.0" encoding="utf-8" ?> <PlgElasticReport> <ReportGroup name="Elastic Reports" isPublic="false" objNum="0"> <ReportItem reportID="1" isPublic="false" objNum="0" config="Reports\ElasticReport1.xml" prefix="MyRep" cnlNums="">My report</ReportItem> </ReportGroup> </PlgElasticReport>
ReportGroup element attributes:
name - the display name of the report group;
isPublic - a value indicating whether the group is public, that is, available to all users;
objNum - the number of the object to which reports of the group belong. Restricts the group visibility according to a user's access rights to the object.
ReportItem element attributes:
reportID - the report identifier, unique within the configuration file;
isPublic - a value indicating whether the report is public, that is, available to all users;
objNum - the number of the object to the report belong. Restricts the report visibility according to a user's access rights to the object;
config - the path of the report form configuration file relative to the views directory,
prefix - the file name prefix used when downloading the report,
cnlNums - the predefined channel numbers for which the report is generated.
You can customize your own report styles, including fonts, colors, cell sizes, etc. For each report format, styles are configured separately.
PdfStyleCustom.xml files specify the formatting of reports in PDF format. These files are located in the web application directory
PdfStyleDefault.xml file contains the default styles and should remain unchanged. Custom styles are added to the
PdfStyleCustom.xml file. When creating custom styles, you can inherit new styles from existing ones or override existing styles.
ExcelStyleCustom.xml files, located in the same directory, specify the formatting of reports in Excel format. The
ExcelStyleDefault.xml file contains default styles and should remain unchanged. Custom styles are added to the
ExcelStyleCustom.xml file. Please note that PDF and Excel style file formats are different.
html-style-custom.css files define the display of reports in HTML format. The files are located in the
ScadaWeb\wwwroot\plugins\ElasticReport\css directory. Custom styles are added to the
html-style-custom.css file using Cascading Style Sheets (CSS) rules.
Fonts in PDF Format
When generating reports in PDF format, the Arial font is used by default. If the required font is not available in the operating system, it is replaced with the built-in Segoe WP font. To change the report font, edit the styles file.
The font search is performed using the following algorithm:
- The search directory is selected. On Windows, the search is performed in the
C:\Windows\Fontsdirectory, on Linux in the
Based on the font name (FontFamily), the required font file names are determined.
- Regular font:
- Bold font:
- Italic font:
- Bold italic font:
- Regular font:
- Fallback font file names (candidates) are determined. For bold or italic fonts, regular font files are used as candidates. There are no fallback options for a regular font.
- If a desired or fallback font is found in the search directory, the font file is loaded and provided for report generation. The search is not case sensitive.
The default fonts usually do not contain characters for languages such as Chinese and Korean. To generate reports in such languages, it is recommended to install the Arial Unicode MS font. On Windows, the font installation is required for all users so that the font file is placed in the
Fonts in Excel Format
In generated reports in Excel format, only the font name is specified; the font itself is not included in the report file. The default font is Arial. When a file is opened in Microsoft Excel or Libre Office Calc, the application loads the font from the system. If the font is missing, automatic replacement is used. You can change the font using the styles file.