Excel.RangeBorderCollection class

範囲の境界線を構成する複数の境界線オブジェクトを表します。

Extends

プロパティ

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

count

コレクションに含まれる境界線オブジェクトの数。

items

このコレクション内に読み込まれた子アイテムを取得します。

tintAndShade

範囲の境界線の色を明るくするか暗くする double を指定します。 値は -1 (最も暗い) から 1 (最も明るい) の間です。元の色は 0 です。 null値は、罫線コレクション全体に統一されたtintAndShade設定がないことを示します。

メソッド

getItem(index)

オブジェクトの名前を使用して、境界線オブジェクトを取得します。

getItem(index)

オブジェクトの名前を使用して、境界線オブジェクトを取得します。

getItemAt(index)

オブジェクトのインデックスを使用して、境界線オブジェクトを取得します。

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Excel.RangeBorderCollection オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、コレクションの項目から読み込まれたプロパティの浅いコピーを含む "items" 配列を含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.RangeBorderCollectionData として型指定された) を返します。

プロパティの詳細

context

オブジェクトに関連付けられている要求コンテキスト。 これにより、アドインのプロセスが Office ホスト アプリケーションのプロセスに接続されます。

context: RequestContext;

プロパティ値

count

コレクションに含まれる境界線オブジェクトの数。

readonly count: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.1

items

このコレクション内に読み込まれた子アイテムを取得します。

readonly items: Excel.RangeBorder[];

プロパティ値

tintAndShade

範囲の境界線の色を明るくするか暗くする double を指定します。 値は -1 (最も暗い) から 1 (最も明るい) の間です。元の色は 0 です。 null値は、罫線コレクション全体に統一されたtintAndShade設定がないことを示します。

tintAndShade: number;

プロパティ値

number

注釈

API セット: ExcelApi 1.9

メソッドの詳細

getItem(index)

オブジェクトの名前を使用して、境界線オブジェクトを取得します。

getItem(index: Excel.BorderIndex): Excel.RangeBorder;

パラメーター

index
Excel.BorderIndex

取得するボーダー オブジェクトのインデックス値。 詳細は「Excel.BorderIndex」をご覧ください。

返品

注釈

API セット: ExcelApi 1.1

await Excel.run(async (context) => {
    const sheetName = "Sheet1";
    const rangeAddress = "A1:F8";
    const worksheet = context.workbook.worksheets.getItem(sheetName);
    const range = worksheet.getRange(rangeAddress);
    const border = range.format.borders.getItem(Excel.BorderIndex.edgeTop);
    border.load('style');
    await context.sync();

    console.log(border.style);
});

getItem(index)

オブジェクトの名前を使用して、境界線オブジェクトを取得します。

getItem(index: "EdgeTop" | "EdgeBottom" | "EdgeLeft" | "EdgeRight" | "InsideVertical" | "InsideHorizontal" | "DiagonalDown" | "DiagonalUp"): Excel.RangeBorder;

パラメーター

index

"EdgeTop" | "EdgeBottom" | "EdgeLeft" | "EdgeRight" | "InsideVertical" | "InsideHorizontal" | "DiagonalDown" | "DiagonalUp"

取得するボーダー オブジェクトのインデックス値。 詳細は「Excel.BorderIndex」をご覧ください。

返品

注釈

API セット: ExcelApi 1.1

getItemAt(index)

オブジェクトのインデックスを使用して、境界線オブジェクトを取得します。

getItemAt(index: number): Excel.RangeBorder;

パラメーター

index

number

取得するオブジェクトのインデックス値。 0 を起点とする番号になります。

返品

注釈

API セット: ExcelApi 1.1

await Excel.run(async (context) => { 
    const sheetName = "Sheet1";
    const rangeAddress = "A1:F8";
    const worksheet = context.workbook.worksheets.getItem(sheetName);
    const range = worksheet.getRange(rangeAddress);
    const border = range.format.borders.getItemAt(0);
    border.load('sideIndex');
    await context.sync();
    
    console.log(border.sideIndex);
});

load(options)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(options?: Excel.Interfaces.RangeBorderCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.RangeBorderCollection;

パラメーター

options

Excel.Interfaces.RangeBorderCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions

読み込むオブジェクトのプロパティのオプションを指定します。

返品

load(propertyNames)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNames?: string | string[]): Excel.RangeBorderCollection;

パラメーター

propertyNames

string | string[]

読み込むプロパティを指定するコンマ区切りの文字列または文字列の配列。

返品

await Excel.run(async (context) => { 
    const sheetName = "Sheet1";
    const rangeAddress = "A1:F8";
    const worksheet = context.workbook.worksheets.getItem(sheetName);
    const range = worksheet.getRange(rangeAddress);
    const borders = range.format.borders;
    borders.load('items');
    await context.sync();
    
    console.log(borders.count);
    for (let i = 0; i < borders.items.length; i++) {
        console.log(borders.items[i].sideIndex);
    }
});

load(propertyNamesAndPaths)

オブジェクトの指定されたプロパティを読み込むコマンドを待ち行列に入れます。 プロパティを読み取る前に、context.sync() を呼び出す必要があります。

load(propertyNamesAndPaths?: OfficeExtension.LoadOption): Excel.RangeBorderCollection;

パラメーター

propertyNamesAndPaths
OfficeExtension.LoadOption

propertyNamesAndPaths.select は読み込むプロパティを指定するコンマ区切りの文字列であり、 propertyNamesAndPaths.expand は読み込むナビゲーションのプロパティを指定するコンマ区切りの文字列です。

返品

toJSON()

API オブジェクトが JSON.stringify() に渡されるときに、より有用な出力を提供するために、JavaScript toJSON() メソッドをオーバーライドします。 (次に、JSON.stringify渡されたオブジェクトの toJSON メソッドを呼び出します)。元の Excel.RangeBorderCollection オブジェクトが API オブジェクトであるのに対し、 toJSON メソッドは、コレクションの項目から読み込まれたプロパティの浅いコピーを含む "items" 配列を含むプレーンな JavaScript オブジェクト ( Excel.Interfaces.RangeBorderCollectionData として型指定された) を返します。

toJSON(): Excel.Interfaces.RangeBorderCollectionData;

返品