I have a excel macro enabled workbook with custom macros. Our users can access a website and a there is a download process which populates the sheets of the workbook with data and downloads the complete book.
When writing to a xlsm workbook with empty sheets, the original macro's should remain after writing the file.
It seems the original macro VBA details are getting stripped from the file when it's written to the php:output stream
See the code below
<?php
// load the workbook
$spreadsheet = PhpOffice\PhpSpreadsheet\IOFactory::load("BHAA.Race.Master.xlsm");
// create a writer instance
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx");
// set the headers
header("Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
header("Content-Disposition: attachment; filename=05featuredemo.xlsm");
header("Pragma: no-cache");
header("Expires: 0");
// write to the output stream
$writer->save('php://output');
PhpSpreadsheet: dev-develop
PHP: 5.6.30
The root cause seems to be a duplicate of #170
Any news ?
Any Update?
Any update?
Most helpful comment
Any update?