-
Notifications
You must be signed in to change notification settings - Fork 21
/
Showing a Report in the Viewer in an HTML template.php
52 lines (43 loc) · 1.35 KB
/
Showing a Report in the Viewer in an HTML template.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once '../vendor/autoload.php';
use Stimulsoft\Report\StiReport;
use Stimulsoft\Viewer\StiViewer;
// Creating a viewer object and set the necessary javascript options
$viewer = new StiViewer();
$viewer->javascript->relativePath = '../';
// Processing the request and, if successful, immediately printing the result
$viewer->process();
// Creating a report object
$report = new StiReport();
// Loading a report by URL
// This method does not load the report object on the server side, it only generates the necessary JavaScript code
// The report will be loaded into a JavaScript object on the client side
$report->loadFile('../reports/SimpleList.mrt');
// Assigning a report object to the viewer
$viewer->report = $report;
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
<title>Showing a Report in the Viewer in an HTML template</title>
<style>
html, body {
font-family: sans-serif;
}
</style>
<?php
// Rendering the necessary JavaScript code of the viewer
$viewer->javascript->renderHtml();
?>
</head>
<body>
<h2>Showing a Report in the Viewer in an HTML template</h2>
<hr>
<?php
// Rendering the visual HTML part of the viewer
$viewer->renderHtml();
?>
</body>
</html>