更新时间:2022-01-30 01:27:41
从另一个方向思考!
不是将数据从php推送到excel,而是将数据连接添加到excel,它将从php端点taht publish xml检索其数据.
Instead of pushing data to excel from php, add a data connection to excel that will retrieve its data from a php endpoint taht publish xml.
不知道它是否适用,但是实现起来要容易得多.
Don't know if it applies, but it's far more easier to implement.
此外,您将完全控制excel文件,保留所有自定义设置,包括VBA.
Moreover, you will have total control on the excel file, keeping all customisations, including VBA.
最后,如果您朝着这个方向发展,您将避免管理所有混乱的COM对象.
And finally, you will avoid all messy COM object managing if you end up in this direction.
此解决方案的步骤:
yourdata.php
会以XML生成数据).yourdata.php
will produce the data in XML).在那之后,您将在Excel中拥有一个列表,该列表将链接到您的xml源.只需右键单击列表/刷新以获取最新数据(或将数据连接配置为在打开时自动刷新).
After that, you will have a list in Excel, than is linked to your xml source. SImply right lick the list / refresh to get the latest data (or configure the data connection to auto refresh at opening).