0

I am testing GemBox.Spreadsheet (47.0.1031) and found a note that R1C1-formulas are available in the latest versions.

But, how does it work? My tests have failed so far:

SpreadsheetInfo.SetLicense("FREE-LIMITED-KEY");
var f = new ExcelFile();
var ws = f.Worksheets.Add("Sheet1");
f.CalculationOptions.PrioritizeR1C1ReferencingNotation = true;

for(int i = 0; i<50; i++)
{
    ws.Cells[i, 0].Value = i + 1;
    ws.Cells[i, 1].Formula = "=RC[-1] * 17";
}
f.Save(..path..);

not even =R1C1 works, and =RC1 is read as an absolute reference (column RC row 1), despite my attempt with the PrioritizeR1C1ReferencingNotation setting.

Excel shows a warning about corrupted content in /xl/worksheets/sheet1.xml-Part when opening the file and removes the formula.

4

1 回答 1

0

以前,仅计算引擎支持 R1C1 表示法。
不过,请尝试使用当前最新的错误修复版本NuGet 包

并尝试以下操作:

var ef = new ExcelFile();
var ws = ef.Worksheets.Add("Sheet1");

for (int i = 0; i < 50; i++)
{
    ws.Cells[i, 0].Value = i + 1;
    ws.Cells[i, 1].FormulaR1C1 = "=RC[-1] * 17";
}

ef.Save("output.xlsx");
于 2020-10-21T12:55:18.687 回答