Guest User

Untitled

a guest
May 22nd, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. require 'vendor/autoload.php';
  2.  
  3. use PhpOfficePhpSpreadsheetSpreadsheet;
  4. use PhpOfficePhpSpreadsheetWriterXlsx;
  5.  
  6. $spreadsheet = new Spreadsheet();
  7. $sheet = $spreadsheet->getActiveSheet();
  8. $sheet->setCellValue('A1', 'Hello World !');
  9.  
  10. $writer = new Xlsx($spreadsheet);
  11. $writer = PhpOfficePhpSpreadsheetIOFactory::createWriter($spreadsheet, 'Xlsx');
  12.  
  13. header('Content-Type: application/vnd.ms-excel');
  14. header('Content-Disposition: attachment; filename="hello_world.xlsx"');
  15. $writer->save("php://output");
  16.  
  17. PHP Warning: ZipArchive::close(): Failure to create temporary file: No such file or directory in /Users/sg/GitWorkingCopies/xxx1/xxx2/library/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php on line 374
  18. PHP Fatal error: Uncaught exception 'PhpOfficePhpSpreadsheetWriterException' with message 'Could not close zip file php://output.' in /Users/sg/GitWorkingCopies/xxx1/xxx2/library/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx.php:375
Add Comment
Please, Sign In to add comment