This example shows how to load a report and assign it to the viewer. You need to create the report object of the
StiReport
type, then load the report template file by calling the
loadFile()
method. To display report in the viewer you can simply assign a report object to the report property of the viewer. If the report is not rendered, the viewer renders it automatically:
<script type="text/javascript">
// Create the report viewer with default options
var viewer = new Stimulsoft.Viewer.StiViewer(null, "StiViewer", false);
// Create a new report instance
var report = new Stimulsoft.Report.StiReport();
// Load report from url
report.loadFile("../reports/SimpleList.mrt");
// Assign report to the viewer, the report will be built automatically after rendering the viewer
viewer.report = report;
</script>
In the screenshot below you can see the result of the sample code: