-
Hi Everyone! code Snippet:
That last line ends up tracing to BaseWriter.php, which is throwing this error: seems like a permissions error for the user that runs on the server, but I'm unsure how to edit the level of access for the output stream. any advice would be very appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It sounds like you are trying to download the file from a browser. If so, the following code adapted from samples/Basic/01_Simple_download_Xlsx should give you an idea how to proceed: // Redirect output to a client’s web browser (Xlsx)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="output.xlsx"'); // name changed to match sample code above
header('Cache-Control: max-age=0');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modified
header('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header('Pragma: public'); // HTTP/1.0
$writer = IOFactory::createWriter($outputSpreadsheet, 'Xlsx'); // variable name changed to match sample code
$writer->save('php://output'); |
Beta Was this translation helpful? Give feedback.
It sounds like you are trying to download the file from a browser. If so, the following code adapted from samples/Basic/01_Simple_download_Xlsx should give you an idea how to proceed: