Spread Studio .NET :*运用的公式引擎

Spread Studio .NET :*使用的公式引擎

Spread 表格控件强大的公式计算引擎支持300多种内置函数,并支持通过内置函数和运算符来自定义公式。支持的函数包括日期、时间函数、工程计算函数、财务计算函数、逻辑函数、数学和三角函数、统计函数、文本函数等。同时,Spread 表格控件提供 FormulaTextBox 公式引擎提供用户在运行时编辑公式。本篇文章将阐述 FormulaTextBox 公式引擎的使用方法。

1.在工具箱中拖拽 FormulaTextBox 控件和 Spread 表格控件,到 form 中:

Spread Studio .NET :*运用的公式引擎

2.在后台代码中添加以下代码,关联 FormulaTextBox 控件和 Spread 表格控件:

this.formulaTextBox1.Attach(this.fpSpread1);

 

运行效果如图:

Spread Studio .NET :*运用的公式引擎 

怎么样?是不是很简单呢?这样我们就轻松的添加了 FormulaTextBox 公式引擎。

3. 没错,Spread 内置 300 多种公式,有些公式的名称过于复杂,我们无法一一牢记。这时,我们可以调用 FormulaEditorUI 对话框来查看 Spread 表格控件的内置公式。这里我们通过 button 的点击事件来调用对话框:

 private void button1_Click(object sender, EventArgs e)
 {
       FarPoint.Win.Spread.FormulaEditorUI formulaEditor = 
       new FarPoint.Win.Spread.FormulaEditorUI(this.fpSpread1.Sheets[0]);
       formulaEditor.ShowDialog();
 }
 
运行效果图:
 Spread Studio .NET :*运用的公式引擎

 

以上即为FormulaTextBox 公式引擎的使用方法。

测试 Demo : VS 2010 + Spread Studio .NET 7 + Framework 4.0

Demo 下载: 点击下载

使用控件查看地址 :点击查看