当前位置: 动力学知识库 > 问答 > 编程问答 >

ms office - Load formulasR1C1 of a formula that contains ranges in Excel Online

问题描述:

I need to get formulasR1C1 of cells in an add-in. It does not seem that Excel Online gets right formulasR1C1 when the argument of the formula contains ranges (rather than single cells).

For example, let's enter formulasR1C1 =SUM(RC[2]:RC[3]) (ie, =SUM(E5:F5) in A1 style) in Cell C5. Here is a screenshot under Excel 2016 for Windows in R1C1 style:

Then, we use the following code to read its formulas and formulasR1C1.

function test () {

Excel.run(function (ctx) {

var c5 = ctx.workbook.worksheets.getItem("Sheet1").getRange("C5");

c5.load(["formulas", "formulasR1C1"]);

return ctx.sync().then(function () {

document.getElementById("result").innerHTML =

"C5.formulas: " + c5.formulas[0][0] + "<br>" +

"C5.formulasR1C1: " + c5.formulasR1C1[0][0];

});

});

}

In Excel 2016 for Windows, it returns correctly:

However, in Excel Online, the returned formulasR1C1 is not correct:

Note that, for a formula that contains ONLY single cells (eg, =RC[2]+RC[3]), formulasR1C1 are correctly loaded in Excel Online.

网友答案:

Definitely sounds like a bug. Let me redirect it to the team. Stay tuned.

分享给朋友:
您可能感兴趣的文章:
随机阅读: