Is it possible to use PHPExcel to edit an existing template file, and maintain existing formatting / spreadsheet objects

牧云@^-^@ 提交于 2020-01-04 11:43:44

问题


I'm looking for a server-side (PHP) way of manipulating / producing xls / xlsx files from MySQL data.

I have an existing template xls file, with various relatively complicated cell dependant formulas and charts and such included, my hope is that I can upload this template file to my server and use PHPExcel to edit that file, and save it: allowing it to be downloaded.

So my formulas are kept, the charts are kept, and I simply have to edit the data for certain cells based on values from the database --> charts drawn based on these values.

Is that kind of thing within PHPExcels remit?

Reading a related question here: PHPExcel modify existing .xlsx file with multiple worksheet

Someone stated:

Macros and User-Defined Functions are not supported in PHPExcel; and the library discards any unsupported features of a workbook when it is loaded, so they don't exist in the PHPExcel object at all... when saving, PHPExcel only saves those elements of the workbook that exist in the PHPExcel object.

Would a user defined function include simple cell formulas?

Thanks!


回答1:


No. Simple cell formulas will still be there. Just not any VBA code.




回答2:


PHPExcel can handle quite complex cell formulae, though it does have some limitations:

  • Only 316 out of 356 functions for Excel 2007 are currently supported, and those that are don't necessarily implement all features of the function
  • None of the additional functions for Excel 2010 and Excel 2013 are supported
  • Analysis toolpack functions aren't support for Excel BIFF files
  • VBA script is not supported, this includes any user-defined functions
  • Array formulae aren't supported
  • 3D-cell references are not supported


来源:https://stackoverflow.com/questions/14633818/is-it-possible-to-use-phpexcel-to-edit-an-existing-template-file-and-maintain-e

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!