本文整理汇总了C#中Workbook.CalculateAllValue方法的典型用法代码示例。如果您正苦于以下问题:C# Workbook.CalculateAllValue方法的具体用法?C# Workbook.CalculateAllValue怎么用?C# Workbook.CalculateAllValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workbook
的用法示例。
在下文中一共展示了Workbook.CalculateAllValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: btnRead_Click
private void btnRead_Click(object sender, EventArgs e)
{
using (Stream buffer = this.WriteFormulas())
{
//load
Workbook workbook = new Workbook();
workbook.LoadFromStream(buffer);
//calculate all cells' formula
workbook.CalculateAllValue();
//read cells' value to data table
Worksheet sheet = workbook.Worksheets[0];
DataTable dataTable = new DataTable();
dataTable.Columns.Add("Formulas", typeof(String));
dataTable.Columns.Add("Results", typeof(Object));
foreach (CellRange row in sheet["A5:B46"].Rows)
{
String formula = row.Columns[1].Formula;
Object value = row.Columns[1].FormulaValue;
dataTable.Rows.Add(formula, value);
}
this.dataGrid1.DataSource = dataTable;
}
}
示例2: btnExport_Click
private void btnExport_Click(object sender, System.EventArgs e)
{
using (Stream buffer = this.WriteFormulas())
{
//load
Workbook workbook = new Workbook();
workbook.LoadFromStream(buffer);
//calculate all cells
workbook.CalculateAllValue();
//export
Worksheet sheet = workbook.Worksheets[0];
this.dataGrid1.DataSource = sheet.ExportDataTable(sheet["A4:B46"], true, true);
}
}