给出以下代码:
using Aspose.Cells
// {...}
Workbook workbook = new Workbook();
Worksheet virtualWorksheet = workbook.Worksheets[0];
virtualWorksheet.Cells[0, 0].Formula ="=1<2";
如何评估Cell [0,0]中的公式?
bool isCellTrue = virtualWorksheet.Cells[0, 0].BoolValue; // will generate an exception at run-time
答案 0 :(得分:1)
来自:http://www.aspose.com/community/forums/permalink/212217/212232/showthread.aspx#212232
调用Workbook.CalculateFormula()方法在运行时获取/检索计算值之前计算工作簿中的所有公式,例如
Workbook workbook = new Workbook();
Worksheet virtualWorksheet = workbook.Worksheets[0];
virtualWorksheet.Cells[0, 0].Formula ="=1<2";
workbook.CalculateFormula();
bool isCellTrue = virtualWorksheet.Cells[0, 0].BoolValue;