Skip to content

XSLM Workbook - macro logic is removed when file is written to. #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
emeraldjava opened this issue Jun 13, 2017 · 5 comments
Closed

XSLM Workbook - macro logic is removed when file is written to. #172

emeraldjava opened this issue Jun 13, 2017 · 5 comments

Comments

@emeraldjava
Copy link

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.

What is the expected behavior?

When writing to a xlsm workbook with empty sheets, the original macro's should remain after writing the file.

What is the current behavior?

It seems the original macro VBA details are getting stripped from the file when it's written to the php:output stream

What are the steps to reproduce?

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');

Which versions of PhpSpreadsheet and PHP are affected?

PhpSpreadsheet: dev-develop
PHP: 5.6.30

@PowerKiKi
Copy link
Member

The root cause seems to be a duplicate of #170

@pierre-H
Copy link

pierre-H commented May 3, 2018

Any news ?

@ktnthkkr
Copy link

Any Update?

@originrobot
Copy link

Any update?

1 similar comment
@leandro47
Copy link

Any update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants