在epplus中使用计算单元

时间:2018-06-27 07:08:06

标签: epplus

我想在 Epplus 中使用公式或计算的单元格。以这种方式,当条件为true时,公式的单元格加上条件为true的单元格,则此循环将持续到结束行。 当我运行这段代码时,Visual Studio会给我错误,表面上,这段代码是正确的。

for (int x = 1; x <= sheet2.Dimension.Rows; x++)
            {
                for (int y = 1; y <= sheet.Dimension.Rows; y++)
                {
                    if (sheet.Cells[y, 1].Value.ToString() != null)
                    {
                        if (sheet2.Cells[x, 1].Value.Equals(sheet.Cells[y, 1].Value.ToString()))
                        {

                            sheet2.Cells["D" + x].Formula = "D" + x + "+ C" + y;
                            sheet2.Cells["D" + x].Style.Numberformat.Format = "#,##0";
                            sheet2.Cells["D" + x].Calculate();
                        }
                    }
                }
            }

this error happened

0 个答案:

没有答案
相关问题