Using with Express
Наши примеры проектов и шаблоны отчётов помогут Вам разобраться в основах работы с нашими продуктами.An Express server can host the Reports.JS viewer page and serve report templates from its own routes.
Build the viewer in the served page.
How it works. Express acts as the static and template host while the viewer runs in the browser, keeping the server role to routing and file delivery.
Build the viewer in the served page.
<script src="stimulsoft.reports.js"></script>
<script src="stimulsoft.viewer.js"></script>
<script>
var options = new Stimulsoft.Viewer.StiViewerOptions();
options.appearance.fullScreenMode = true;
var viewer = new Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
viewer.renderHtml("viewer");
var report = new Stimulsoft.Report.StiReport();
report.loadFile('/report'); // served by an Express route
viewer.report = report;
</script>- Express serves both the static Reports.JS scripts and the viewer HTML page.
report.loadFile('/report')— loads the template from an Express route, so the server controls which report is delivered.
How it works. Express acts as the static and template host while the viewer runs in the browser, keeping the server role to routing and file delivery.