如何在C中使用xlslib在excel中设置公式

时间:2013-10-30 17:46:26

标签: c xlslib

我有以下示例:

workbook  *wb = 0;
worksheet *ws = 0;
cell_t *c1, *c2 = 0;

wb = xlsNewWorkbook();
ws = xlsWorkbookSheet(wb, "test");

c1 = xlsWorksheetNumberDbl(ws, 2, 1, 12345.512, NULL);
xlsWorksheetNumberDbl(ws, 3, 1, 223.011, NULL);
c2 = xlsWorksheetNumberDbl(ws, 4, 1, 34678.010, NULL);

formula_t *formula = xlsWorksheetFormula(ws);
xlsFormulaPushCellAreaReference(formula, c1, c2, CELL_RELATIVE_A1);
xlsFormulaPushFunction(formula, FUNC_SUM);
xlsWorksheetFormulaCell(ws, 5, 1, formula, NULL);

xlsWorkbookDump(wb, "test.xls");
xlsDeleteWorkbook(wb);

但似乎公式无法正常工作。

在结果单元格上显示#VALUE!在公式栏上我得到= B3:B5代替= SUM(B3:B5)。

请帮帮我吗?

由于

0 个答案:

没有答案