0

如何在 javascript API 中读取 ClientResult 的值?

我有一个 Excel 表(tbl)。我正在尝试读取 getCount() 方法返回的 ClientResult 对象的值:

var bodyRange = tbl.getDataBodyRange();
var visCells = bodyRange.getSpecialCells("Visible");
visCells.load("areas");
context.sync();
areas = visCells.areas;
console.log(areas); //its OK it prints a collection object
var count = areas.getCount();
context.sync();
console.log(count.value); //error: ichApi.Error: The value of the result object has not been loaded yet. Before reading the value property, call "context.sync()" on the associated request context.

我想阅读“count.value”。问题是“count”是一个 ClientResult,这意味着它缺少 load() 方法。

如果我尝试使用 console.log(count.value),我会收到错误消息,指出必须加载“value”属性并在访问此属性之前调用 context.sync()。

我无法在“count”上应用 load() 方法来访问此 ClientResult 的“value”属性。怎么做?

谢谢

4

0 回答 0