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

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

    await report.renderAsync2();

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

function App() {
    return (
        <div className='container'>
            <h4>This sample demonstrates how to export a report to an HTML file and save it:</h4>
            <div className='container-button'>
                <button onClick={saveReportHtml} className='button' title='Export Report to HTML File'>
                    Export to HTML
                </button>
            </div>
        </div>

    );
}

export default App;

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

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.