Showing a Report in the Viewer
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.This example shows how to display a report in the Stimulsoft Viewer without additional event handling. First, include the Stimulsoft libraries:
Next, create a Viewer object and configure JavaScript-related options:
Process any incoming requests using process():
Create a Report object and load a report template. The loadFile() method does not load the report on the server side; it only generates the necessary JavaScript code for the client side:
Assign the report to the viewer:
Finally, render the viewer as a complete HTML page using printHtml():
На скриншоте ниже Вы можете увидеть результат выполнения данного кода:

<?php
require_once '../vendor/autoload.php';
use Stimulsoft\Report\StiReport;
use Stimulsoft\Viewer\StiViewer;
?>
Next, create a Viewer object and configure JavaScript-related options:
$viewer = new StiViewer();
$viewer->javascript->relativePath = '../';
$viewer->javascript->appendHead('<link rel="shortcut icon" href="/../favicon.ico" type="image/x-icon">');
Process any incoming requests using process():
$viewer->process();
Create a Report object and load a report template. The loadFile() method does not load the report on the server side; it only generates the necessary JavaScript code for the client side:
$report = new StiReport();
$report->loadFile('../reports/SimpleList.mrt');
Assign the report to the viewer:
$viewer->report = $report;
Finally, render the viewer as a complete HTML page using printHtml():
$viewer->printHtml();На скриншоте ниже Вы можете увидеть результат выполнения данного кода:
