Export Report from Code
In the report generator, you can export a report from a code to the following formats:
• | Document (Report Snapshot) |
• |
• | XPS |
• | PowerPoint |
• | HTML / HTML5 |
• | Text |
• | Word / Excel |
• | ODT / ODC |
• | CSV |
• | SVG |
You can use the exportDocumentAsync() method for a report object to export.
index.php |
<?php $report = new \Stimulsoft\Report\StiReport(); $report->loadFile('SimpleList.mrt'); $report->render(); $report->exportDocument(\Stimulsoft\StiExportFormat::Pdf); $report->renderHtml(); ?>
|
Information |
Report export doesn't invoke its automatic rendering, so for a loaded report template you should invoke the render() method, which will render a report. This method is not required for ready documents (rendered reports).
|
As arguments to the exportDocument() function, you must specify the required export format from the StiExportFormat enumeration.
Name |
Description |
StiExportFormat::Document |
Saving a document (a rendered report). |
StiExportFormat::Pdf |
Saving in the Adobe PDF format. |
StiExportFormat::Xps |
Saving in the XPS (XML Paper Specification) format. |
StiExportFormat::Ppt2007 |
Saving in the Microsoft PowerPoint format. |
StiExportFormat::Html |
Saving in the HTML format. |
StiExportFormat::Html5 |
Saving in HTML5 format using SVG markup elements. |
StiExportFormat::Text |
Saving in the text format. |
StiExportFormat::Word2007 |
Saving in the Microsoft Word format. |
StiExportFormat::Excel2007 |
Saving in the Microsoft Excel format. |
StiExportFormat::Odt |
Saving in the OpenDocument Text format. |
StiExportFormat::Ods |
Saving in the OpenDocument Spreadsheet format. |
StiExportFormat::Csv |
Saving in the CSV (Comma-Separated Values) data format. |
StiExportFormat::ImageSvg |
Saving in the image of the SVG format. |
After exporting the report, the resulting data stream will be passed to the web browser for download as a file. The file name and MIME data type will be determined automatically.