Render the report in Angular and export it directly from code, without opening the viewer.

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.
@Component({
    selector: "exporting-report-to-html",
    template: `
        <div class="container">
            <h4>This sample demonstrates how to export a report to an HTML file and save it:</h4>
            <div class="container-button">
                <button (click)="saveReportHtml()" class="button" title="Export Report to HTML File">Export to HTML</button>
            </div>
        </div>
        `,
    styleUrls: ['../styles.css']

})

export class ExportingReportToHTML {
    async saveReportHtml() {
        var report = new Stimulsoft.Report.StiReport();
        report.loadFile("Reports/SimpleList.mrt");

        await report.renderAsync2();

        var htmlData = await report.exportDocumentAsync2(Stimulsoft.Report.StiExportFormat.Html);
        Stimulsoft.System.StiObject.saveAs(htmlData, report.reportAlias + ".html", "text/html;charset=utf-8");
    }
}

After renderAsync2(), exportDocumentAsync2(StiExportFormat.Html) returns the HTML data, which StiObject.saveAs writes to a file with the correct MIME type.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.