Spreadsheetlight公式无效

时间:2014-05-07 19:06:03

标签: spreadsheet formula spreadsheetlight

我使用Spreadsheetlight创建Excel文档。我需要在特定单元格上使用公式,但它不起作用。代码:

report.SetCellValue(string.Format("{0}{1}", Report.CELL_MAP.ACTIVITY_CRU_COL, row), string.Format("=IF({0}{1}=0; 0; ROUND(({2}{1}/{0}{1})*100; 0))", Report.CELL_MAP.ACTIVITY_REAL_MD_VAL_COL, row, Report.CELL_MAP.ACTIVITY_INVOICED_MD_VAL_COL));

我有什么遗失的东西吗?设置'=E9'之类的公式作为公式存储在单元格中,并在最终文档中有效。任何想法为什么它不起作用?

1 个答案:

答案 0 :(得分:0)

公式中应该是逗号而不是分号吗?像这样:

report.SetCellValue(string.Format("{0}{1}", Report.CELL_MAP.ACTIVITY_CRU_COL, row), string.Format("=IF({0}{1}=0, 0, ROUND(({2}{1}/{0}{1})*100, 0))", Report.CELL_MAP.ACTIVITY_REAL_MD_VAL_COL, row, Report.CELL_MAP.ACTIVITY_INVOICED_MD_VAL_COL));