c# - 为什么在 EPPLUS 的 excel 公式中 = 符号后有 @ 符号?

标签 c# .net excel

这是公式在 excel 中的显示方式:

enter image description here

我想在 Excel 中使用来自 c# 的 EPPLUS 预测公式。代码中的公式是正确的,但是在Excel中出现=@FORECAST(params).

        ExcelRange targetDate = sheet.Cells[listItems + 2, 2];
        ExcelRange values = sheet.Cells[2, 3, listItems+1, 3];
        ExcelRange timeLine = sheet.Cells[2, 2, listItems+1, 2];

        sheet.Cells[8, 4].Formula = "=FORECAST.ETS(" + targetDate + "," + values + "," + timeLine + ",1,1)";
        sheet.Cells[8, 4].Calculate();

我想修剪 @从excel文件中的公式,像这样:
=FORECAST.ETS(B8,C2:C7,B2:B7,1,1)

最佳答案

在代码中,您不需要放置“=”字符

只需使用:

  sheet.Cells[8, 4].Formula = "FORECAST.ETS(" + targetDate + "," + values + "," + timeLine + ",1,1)";

关于c# - 为什么在 EPPLUS 的 excel 公式中 = 符号后有 @ 符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58423726/

相关文章:

c# - 将 Json 数组解析为 C# 中的类

c# - WCF 应用程序中的 session 变量

c# - 如何防止 DataGridView 共享行?

excel - 随着时间的推移分配值(value)

C# 6 空条件运算符不适用于 LINQ 查询

c# - Entity Framework 3.5 中的左连接

excel - .FindNext 在 .Find 函数之后失败(excel vba)

VBA:VLookUp 多个结果

c# - Mongodb AsQueryable()

.net - 在 Visual Studio 编辑器中检测事件