You can use built-in formulas in cells. Use the formula method or setFormula method to add formulas. You can also specify the reference style with the referenceStyle property.
Using Code
This example sets the referenceStyle property in the Workbook method.你可以使用内建的公式。
使用 formula 方法或者使用 setFormula 方法来添加公式。
你也可以使用 referenceStyle 属性来设置引用样式。
示例代码
以下代码设置了 Workbook 中的 referenceStyle 属性
JavaScript | Copy Code |
spread.options.referenceStyle = GC.Spread.Sheets.ReferenceStyle.R1C1;//spread.options.referenceStyle = GC.Spread.Sheets.ReferenceStyle.A1; |
|
Using Code
This example uses the formula method.示例代码
以下代码使用了 formula 方法。
JavaScript | Copy Code |
activeSheet.setValue(0,0,1);activeSheet.setValue(0,1,2);activeSheet.setValue(0,2,10);activeSheet.getCell(1,1).formula("=SUM(A1:C1)"); |
|
See Also另见
Formula Reference
Wildcard Characters in a Formula