Viewer Events

Information

Since dashboards and reports use the same unified template format - MRT, methods for loading the template and working with data, the word “report” will be used in the documentation text.

The HTML5 Viewer component supports events that allow you to execute necessary operations before specific actions, such as printing and exporting, sending reports by email, interactivity, etc. Below is a sample of processing viewer events.

Default.aspx

...
<cc1:StiWebViewer ID="StiWebViewer1" runat="server"
    OnExportReport="StiWebViewer1_ExportReport">
</cc1:StiWebViewer>
...

Default.aspx.cs

...
protected void StiWebViewer1_ExportReport(object sender, StiExportReportEventArgs e)
{
    if (e.Format == StiExportFormat.Pdf)
    {
        StiPdfExportSettings pdfSettings = e.Settings as StiPdfExportSettings;
        pdfSettings.ImageQuality = 50;
        pdfSettings.ImageResolution = 50;
        pdfSettings.ImageCompressionMethod = StiPdfImageCompressionMethod.Jpeg;
    }
}
...

List of events

Name Description
OnGetReport The event occurs when requesting a report for preview.
OnGetReportData The event occurs when connecting data of a report before it is rendered.
OnPrintReport The event occurs when printing reports. This is not relevant when viewing dashboards.
OnExportReport The event occurs when exporting reports.
OnExportReportResponse The event occurs after exporting reports before saving the exported file.
OnEmailReport The event occurs when sending a report by Email. This is not relevant when viewing dashboards.
OnInteraction The event occurs when interactive actions of the viewer, such as using report variables, dynamic collapsing, and sorting.
OnDesignReport The event occurs when pressing the Design button on the toolbar of the viewer.
OnViewerEvent The event occurs when any action of the viewer.