信息:以下代码位于foreach循环中
使用:
indexSheet.Cell("G" + cellIndex).FormulaA1 = "=SUM(A1:A10)";
只有在我直接在Excel中输入时才有效:
indexSheet.Cell("G" + cellIndex).FormulaA1 = "=FIND(\"erw\";H5)"; // with Property
indexSheet.Cell("G" + cellIndex).SetFormulaA1("=FIND(\"erw\";H5)"); //with Function
indexSheet.Cell("G" + cellIndex).FormulaA1 = $"COUNTIF(H{cellIndex};\"*\"&$C$2&\"*\")*(MAX($G$4:G{cellIndex - 1})+1)";
indexSheet.Cell("B" + cellIndex).FormulaA1 = $"=IF(ROW()-{cellIndex}>MAX(G:G);\"\";HYPERLINK(CONCATENATE(\"#\";(INDEX(H:H;MATCH(ROW()-4;G:G;0)));\"!B{cellIndex}\");(INDEX(H:H;MATCH(ROW()-4;G:G;0)))))";
我已经检查/尝试过:
SUM()
或FIND()
那样工作 - > (-SUM有效,FIND无效)Excel告诉我: Picture1
而且: Picture2
图2中的链接XML日志文件包含有关已删除部分的信息
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<recoveryLog xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
<logFileName>error035720_03.xml</logFileName><summary>Errors were detected in file 'C:\Users\XXX\Documents\Output\CodeBook.xlsx'</summary>
<removedRecords>
<removedRecord>Removed Records: Formula from /xl/worksheets/sheet.xml part</removedRecord>
<removedRecord>Removed Records: Formula from /xl/calcChain.xml part (Calculation properties)</removedRecord>
</removedRecords>
</recoveryLog>
答案 0 :(得分:3)
你不能使用分号(;
)来分隔closedxml中的参数。使用逗号(,
),如下所示:
indexSheet.Cell("G" + cellIndex).FormulaA1 = "=FIND(\"erw\",H5)";
这就是SUM(range)
有效但[{1}}没有...