ExcelScript.WorkbookRangeAreas interface

表示多个工作表中一个或多个矩形区域的集合。

注解

示例

/**
 * This script finds the direct precedents of the active cell.
 * It changes the font and color of those precedent cells. 
 */
function main(workbook: ExcelScript.Workbook) {
  // Get the active cell.
  const selected = workbook.getActiveCell();
  
  // Get the cells that are direct precedents of the current cell.
  const precedents : ExcelScript.WorkbookRangeAreas = selected.getDirectPrecedents();

  // Set the font to bold and the fill color to orange for all the precedent cells.
  precedents.getRanges().forEach(range => {
    range.getFormat().getFill().setColor("orange");
    range.getFormat().getFont().setBold(true);
  });
}

方法

getAddresses()

返回 A1 样式的地址数组。 地址值包含每个矩形单元格块的工作表名称, (例如“Sheet1!A1:B4,Sheet1!D1:D4“) 。 此为只读属性。

getAreas()

返回 RangeAreasCollection 对象。 RangeAreas集合中的每个表示一个工作表中的一个或多个矩形区域。

getRangeAreasBySheet(key)

RangeAreas根据集合中的工作表名称或 ID 返回 对象。 如果工作表不存在,则此方法返回 undefined

getRanges()

返回在 对象中 RangeCollection 构成此对象的区域。

方法详细信息

getAddresses()

返回 A1 样式的地址数组。 地址值包含每个矩形单元格块的工作表名称, (例如“Sheet1!A1:B4,Sheet1!D1:D4“) 。 此为只读属性。

getAddresses(): string[];

返回

string[]

getAreas()

返回 RangeAreasCollection 对象。 RangeAreas集合中的每个表示一个工作表中的一个或多个矩形区域。

getAreas(): RangeAreas[];

返回

getRangeAreasBySheet(key)

RangeAreas根据集合中的工作表名称或 ID 返回 对象。 如果工作表不存在,则此方法返回 undefined

getRangeAreasBySheet(key: string): RangeAreas;

参数

key

string

工作表的名称或 ID。

返回

getRanges()

返回在 对象中 RangeCollection 构成此对象的区域。

getRanges(): Range[];

返回