开发者

PHPExcel clone .xlsm with macros

I'm trying to read, clone and write and .xlsm file with PHPExcel but I get an error: Fatal error: Uncaught exception 'Exception' with message 'Worksheet!G177 -> Formula Error: An unexpected error occured' in...

Anybody know how can I read, clone and write and Excel file with macros, I mean the macros are in a template (the file that I reading) I just want to clone that file and write on it, and just keep the macros in the new file开发者_JAVA百科. Is that possible with PHPExcel ? is there another library to do that ?

Thanks .


First:

  • PHPExcel does not support reading Excel macro (.xlsm) files.

Second:

  • it doesn't support macros.

And I'm not aware of any PHP libraries that support this.

The only way that I know for certain that you could do this would be using PHPs COM extension, on a server with MS Excel itself installed.

The only alternative to COM that may work would be Ilia Alshanetsky's Excel extension


This thread is a little old, but I had the same issue where I needed to modify Excel files with macros from PHP. No PHP librairy that I know support edit Excel files without negatively impacting the macros.

However the LibXL library supports the preservation of macros as of version 3.3.1. It's not written in PHP, but what we ended up doing is to write our Excel editing in C++ and we called that c++ program from PHP via the exec() method. It worked very well and had very good performance. Hope it helps somebody.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜