使用PHP将数组公式添加到Excel电子表格中

时间:2021-02-18 07:18:18

I'm generating an excel spreadsheet using the PEAR extension, Spreadsheet_Excel_Writer. I need to add an array formula to one of the cells, but all the info I've read about them only discusses them as if you're in the Excel program itself: it says you have to type in the formula as normal and then press Ctrl+Shift+Enter to switch it to an array formula.

我正在使用PEAR扩展Spreadsheet_Excel_Writer生成excel电子表格。我需要在其中一个单元格中添加一个数组公式,但我读过的关于它们的所有信息只讨论它们就像你在Excel程序本身一样:它说你必须正常输入公式然后按Ctrl + Shift + Enter将其切换为数组公式。

Is there a way I can do this programmatically?

有没有办法以编程方式执行此操作?

1 个解决方案

#1


There is a property called FormulaArray that allows array formulas to be entered programmatically. Hopefully this is exposed to you from your PHP extension.

有一个名为FormulaArray的属性允许以编程方式输入数组公式。希望您的PHP扩展可以向您展示这一点。

Usage:

Sheet1.Range("C1:C3").FormulaArray = "=(A1:A3)*(B1:B3)"

#1


There is a property called FormulaArray that allows array formulas to be entered programmatically. Hopefully this is exposed to you from your PHP extension.

有一个名为FormulaArray的属性允许以编程方式输入数组公式。希望您的PHP扩展可以向您展示这一点。

Usage:

Sheet1.Range("C1:C3").FormulaArray = "=(A1:A3)*(B1:B3)"