mk-j / PHP_XLSXWriter

Lightweight XLSX Excel Spreadsheet Writer in PHP
MIT License
1.84k stars 665 forks source link

Empty xlsx sheet on small example #249

Closed soerendohmen closed 4 years ago

soerendohmen commented 5 years ago

include_once($_SERVER['DOCUMENT_ROOT'].'/xlsxwriter/xlsxwriter.class.php'); $data = array( array('year','month','amount'), array('2003','1','220'), array('2003','2','153.5'), );

$writer = new XLSXWriter();
$writer->writeSheet($data);
$writer->writeToFile('output.xlsx');

Leaves me with an empty file of 2.6K size.

psirus0588 commented 4 years ago

Working code, i cheked by copy paste. Created xlsx file have 4,5 k. What php version do you have?

Check, do you enable errors output:

 error_reporting(E_ALL);
 ini_set('display_errors', 1);
soerendohmen commented 4 years ago

Thank you. Could have checked that myself. :( I had an issue with the tmp directory. Just set my own $tempdir and now everything is fine.