You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<?phprequire__DIR__ . '/vendor/autoload.php';
/* normally the data is pass-over from a web page$string = $_POST['String']; // comma-separated string: contains the entire table data (including the header)$report = explode(",", $string);$cols = count($titles) + 1;*/usePhpOffice\PhpSpreadsheet\Helper\Sample;
usePhpOffice\PhpSpreadsheet\IOFactory;
usePhpOffice\PhpSpreadsheet\Spreadsheet;
$spreadsheet = newSpreadsheet();
$sheet = $spreadsheet->getActiveSheet();
$cols = 9;
$table = [
['1', 'Id No.', 'Stage', 'Status', 'Process No.', 'Process State', 'State Changed', 'JICS', 'JICS Sent Date'],
['92', '33134', 'ACPTD', 'New', '3', '📫', 'Wed Mar 21 2018 16:33:00 GMT-0700 (Pacific Daylight Time)', '✔️', 'Wed Mar 14 2018 00:00:00 GMT-0700 (Pacific Daylight Time)'],
['408','24134','CANCL','Returning','3','📫','Thu Mar 08 2018 12:32:00 GMT-0800 (Pacific Standard Time)','✔️','Mon Dec 28 2015 00:00:00 GMT-0800 (Pacific Standard Time)']
];
//$table = array_chunk($report, $cols);$sheet->fromArray($table, null, 'A1');
//boilerplate code to download the file..header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="'.date('Ydm').'_Export.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be neededheader('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be neededheader('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the pastheader('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifiedheader('Cache-Control: cache, must-revalidate'); // HTTP/1.1header('Pragma: public'); // HTTP/1.0$writer = IOFactory::createWriter($spreadsheet, 'Xls');
$writer->save('php://output');
exit;
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this is still an issue for you, please try to help by debugging it further and sharing your results.
Thank you for your contributions.
This is (most probably) a bug report:
What is the expected behavior?
Get a valid and correctly populated XLS file
What is the current behavior?
Get a broken file, missing cell content
What are the steps to reproduce?
If there is 📫 the spreadsheet is broken:
Which versions of PhpSpreadsheet and PHP are affected?
PHP 5.6.33, phpoffice/phpspreadsheet 1.2.1 (installed via composer)
The text was updated successfully, but these errors were encountered: