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.
import { Stimulsoft } from 'stimulsoft-reports-js-react';

function App() {
    var report = new Stimulsoft.Report.StiReport();
    report.loadFile('Reports/SimpleList.mrt');

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

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

    return (
        <div>
            <button onClick={renderReport}>Render the Report</button>
            <br />
            <br />
            <div id='message'></div>
            <pre id='reportJson'></pre>
        </div>
    );
}

export default App;

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.