A report can be exported from PHP code to several formats. This example renders a report and exposes buttons that export it to PDF, Excel or HTML.

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.
$report = new StiReport();
$report->process();
$report->loadFile('../reports/SimpleList.mrt');
$report->render();

// inside JS-invoked functions:
$report->exportDocument(StiExportFormat::Pdf);
echo $report->getHtml(StiHtmlMode::Scripts);


exportDocument takes a StiExportFormat value; emitting the resulting scripts triggers the export in the browser. Changing the format constant exports to Excel, Word, HTML and other formats the same way.

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.