【发布时间】:2020-01-30 05:09:25
【问题描述】:
我在C# 中编写了以下持续时间计算代码
ExcelPackage excel = new ExcelPackage();
var workSheet = excel.Workbook.Worksheets.Add("Sheet1");
workSheet.View.RightToLeft = true;
var formula="MDURATION(43860.3507195718,44233,0.2,0.199014876362008,2,3)";
workSheet.Cells["Z8"].Formula = formula;
workSheet.Cells["Z8"].Calculate();
var result= (workSheet.Cells["Z8"].Value);
此公式在 Excel 中有效,但在此代码中无效
最后结果变量的值变为{#NAME?}。
但它在 Excel 中的值为.803
【问题讨论】:
-
github.com/JanKallman/EPPlus/wiki/Formula-Calculation 提供了有关如何附加记录器以查看公式哪里出错的建议 - 将其输出添加到问题中可能会有所帮助
-
请注意,list of supported functions 不包含 MDURATION
-
另请注意,要使用的语言环境始终是 en! , VS ; ...
标签: c# excel-formula epplus duration