A report can be rendered without a viewer, for example to process the result server-side. This example renders the report and inspects the output.

Code overview. Initialize the required report objects, render a report from code, and handle the resulting state or output.
@Component({
    selector: "rendering-report-from-code",
    template: `
        <div>
            <button (click)="renderReport()">Render the Report</button>
            <br /><br />
            <div id="message"></div>
            <pre id="reportJson"></pre>
        </div>`
})

export class RenderingReportFromCode {
    report: Stimulsoft.Report.StiReport;

    async renderReport() {
        await this.report.renderAsync2();

        document.getElementById("message")!.innerText = "The report rendering is completed. Pages: " + this.report.renderedPages.count;
        document.getElementById("reportJson")!.innerText = this.report.saveDocumentToJsonString();
    }

    constructor() {
        this.report = new Stimulsoft.Report.StiReport();
        this.report.loadFile("Reports/SimpleList.mrt");
    }
}

renderAsync2() builds the document pages; afterwards renderedPages.count and saveDocumentToJsonString() give access to the rendered result for saving or further processing.

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.