Formula

Cell.Formula property

获取或设置公式Cell.

public string Formula { get; set; }

评论

公式字符串始终以等号 (=) 开头。 并且请始终使用逗号(,) 作为参数分隔符,例如“=SUM(A1, E1, H2)”。

例子

[C#]

Workbook excel = new Workbook();
Cells cells = excel.Worksheets[0].Cells;
cells["B6"].Formula = "=SUM(B2:B5, E1) + sheet1!A1";

[Visual Basic]

Dim excel As Workbook =  New Workbook() 
Dim cells As Cells =  excel.Worksheets(0).Cells 
cells("B6").Formula = "=SUM(B2:B5, E1) + sheet1!A1"

也可以看看