JavaScript API for Office getRange method

2019-07-26 14:19发布

Is there a way to get a range by row, column, numRows, numColumns?

For example:

Excel.run(function (ctx) {
    var sheet = ctx.workbook.worksheets.getActiveWorksheet();
    var range = sheet.getRange(1, 2, 3, 4).load("values");
    ...
});

1条回答
孤傲高冷的网名
2楼-- · 2019-07-26 14:59

In the next release of ExcelAPI 1.7 we will have worksheet.getRangeByIndexes which is exactly what you are looking for.

In the meantime you can achieve the same by doing the following:

var range = sheet.getCell(1,2).getResizedRange(3,4);

-Philip, Software Engineer on the Office Extensibility team

查看更多
登录 后发表回答