Exporting a Report to HTML
Our sample projects and report templates can help you learn the basics of working with our products.This example renders a report and exports it to HTML — either receiving the HTML string for display in the page, or saving it as a file.
Exporting the document. Load and render the report, configure the requested export format, and deliver the generated bytes as a file, stream, or web response.
Exporting the document. Load and render the report, configure the requested export format, and deliver the generated bytes as a file, stream, or web response.
var report = new Stimulsoft.Report.StiReport();
report.loadFile("../reports/SimpleList.mrt");
report.renderAsync(function () { });
function saveReportHtml() {
report.exportDocumentAsync(function (htmlString) {
var fileName = report.reportAlias;
Stimulsoft.System.StiObject.saveAs(htmlString, fileName + ".html", "text/html;charset=utf-8");
}, Stimulsoft.Report.StiExportFormat.Html);
}The export callback receives the HTML as a string, which you can insert into the page or, as here, download as a file. Passing a different StiExportFormat value exports to PDF, Excel, Word and other formats with the same call.