Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
You can try this code to both save the exported pdf file and output it to browser:
$exportHandler = $report->export("SalesQuartersPdf")
->settings([...])
->pdf([...]);
$exportHandler->saveAs("path/on/server/SalesQuarters.pdf");
$exportHandler->toBrowser("SalesQuarters.pdf");
I have exported the file with
$report->run()->exportToExcel(array(
"properties" => array(
"creator" => "Research Study Online",
"title" => $title,
"description" => $description,
"subject" => "Audit Workpapers",
"keywords" => "",
"category" => "",
)
))->toBrowser($this->session->userdata('campaign') . "_workbook.xlsx");
This opens fine in Google Sheets and also in LibreOffice. But in Excel it won't work. Any ideas?
Thnks. Here is an example of an xls that can't be opened in MS excel but works in the other tools. How can I upload this file?
Also, to create this file I create many datastores (all the data stores from the system, but for this user). It takes a REALLY long time. Any other ideas t speed this up?
I am in Europe on vacation. I will send you the file when I get back to my hotel. My plan was to create a workbook for a specific user. The workbook will be used to audit the report. It has a copy of each table, filtered for only the current user. It does however, contain info that needs to kept secure. The copy I will send is just a demo workbook. My app uses ssl so can I assume that the data is secure while being transferred to the user, under normal koolreport use?
If you use ssl connection I think it's secure enough for koolreport data export as long as your ssl certificate is valid.
As for your corrupted excel export file I checked it and found there's html output at the end of the excel content:
xl/worksheets/_rels/sheet22.xml.relsPK 5 5 N %� <html lang="en">
<head>
<!-- Delighted -->
<script type="text/javascript">
...
</script>
<!-- MS Clarity -->
...
Some applications such as Google Sheets, LibreOffice, Mac OS Number, etc can realize the redundant part and open the file but MS Excel refuses it. Please make sure to either exit PHP processing after excel export's saveAs(), toBrowser() or buffer any output except for export content. For example, call ob_start() right after the first saveAs(), toBrowser() and ob_end_clean() right before the next saveAs(), toBrowser().
Thx. I am not exactly sure where to place the start and end. This is what I did:
ob_start();
// $report->run()->exportToExcel()->toBrowser($this->session->userdata('campaign') . "_workbook.xlsx");
$report->run()->exportToExcel(array(
"properties" => array(
"creator" => "Research Study Online",
"title" => $title,
"description" => $description,
"subject" => "Audit Workpapers",
"keywords" => "",
"category" => "",
)
))->toBrowser($this->session->userdata('campaign') . "_workbook.xlsx");
ob_end_clean();
I do not have a Windows PC with me here so I wont be able to see if that fixed until I get back the US in Feb.
Pls try this:
ob_start();
//...put any previous command here if needed
ob_end_clean();
// $report->run()->exportToExcel()->toBrowser($this->session->userdata('campaign') . "_workbook.xlsx");
$report->run()->exportToExcel(array(
"properties" => array(
"creator" => "Research Study Online",
"title" => $title,
"description" => $description,
"subject" => "Audit Workpapers",
"keywords" => "",
"category" => "",
)
))->toBrowser($this->session->userdata('campaign') . "_workbook.xlsx");
exit; //quit processing right after exporting
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo