Excel.WorksheetProtectionChangedEventArgs interface

保護状態の変更イベントを発生させたワークシートに関する情報を提供します。このイベントは、ワークシートで保護状態が更新されたときに発生します。

注釈

[ API セット: ExcelApi 1.14 ]

プロパティ

allowEditRangesChanged

オブジェクトのいずれかが AllowEditRange 変更されたかどうかを指定します。

isProtected

ワークシートの現在の保護状態を取得します。

protectionOptionsChanged

WorksheetProtectionOptions 変更されたかどうかを指定します。

sheetPasswordChanged

ワークシートのパスワードが変更されたかどうかを指定します。

source

イベントのソース。 ローカルまたはリモート (共同編集を使用) できます。

type

イベントの種類を取得します。 詳細は「Excel.EventType」をご覧ください。

worksheetId

保護の状態が変更されたワークシートの ID を取得します。

プロパティの詳細

allowEditRangesChanged

オブジェクトのいずれかが AllowEditRange 変更されたかどうかを指定します。

allowEditRangesChanged: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApiOnline 1.1 ]

isProtected

ワークシートの現在の保護状態を取得します。

isProtected: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/events-worksheet-protection.yaml

async function checkProtection(event: Excel.WorksheetProtectionChangedEventArgs) {
    // This function is an event handler that returns the protection status of a worksheet
    // and information about the changed worksheet.
    await Excel.run(async (context) => {
        const protectionStatus = event.isProtected;
        const worksheetId = event.worksheetId;
        const source = event.source;
        console.log("Protection status changed. Protection status is now: " + protectionStatus + ".");
        console.log("    ID of changed worksheet: " + worksheetId + ".");
        console.log("    Source of change event: " + source + ".");
    });
}

protectionOptionsChanged

WorksheetProtectionOptions 変更されたかどうかを指定します。

protectionOptionsChanged: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApiOnline 1.1 ]

sheetPasswordChanged

ワークシートのパスワードが変更されたかどうかを指定します。

sheetPasswordChanged: boolean;

プロパティ値

boolean

注釈

[ API セット: ExcelApiOnline 1.1 ]

source

イベントのソース。 ローカルまたはリモート (共同編集を使用) できます。

source: Excel.EventSource | "Local" | "Remote";

プロパティ値

Excel.EventSource | "Local" | "Remote"

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/events-worksheet-protection.yaml

async function checkProtection(event: Excel.WorksheetProtectionChangedEventArgs) {
    // This function is an event handler that returns the protection status of a worksheet
    // and information about the changed worksheet.
    await Excel.run(async (context) => {
        const protectionStatus = event.isProtected;
        const worksheetId = event.worksheetId;
        const source = event.source;
        console.log("Protection status changed. Protection status is now: " + protectionStatus + ".");
        console.log("    ID of changed worksheet: " + worksheetId + ".");
        console.log("    Source of change event: " + source + ".");
    });
}

type

イベントの種類を取得します。 詳細は「Excel.EventType」をご覧ください。

type: "WorksheetProtectionChanged";

プロパティ値

"WorksheetProtectionChanged"

注釈

[ API セット: ExcelApi 1.14 ]

worksheetId

保護の状態が変更されたワークシートの ID を取得します。

worksheetId: string;

プロパティ値

string

注釈

[ API セット: ExcelApi 1.14 ]

// Link to full sample: https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/excel/30-events/events-worksheet-protection.yaml

async function checkProtection(event: Excel.WorksheetProtectionChangedEventArgs) {
    // This function is an event handler that returns the protection status of a worksheet
    // and information about the changed worksheet.
    await Excel.run(async (context) => {
        const protectionStatus = event.isProtected;
        const worksheetId = event.worksheetId;
        const source = event.source;
        console.log("Protection status changed. Protection status is now: " + protectionStatus + ".");
        console.log("    ID of changed worksheet: " + worksheetId + ".");
        console.log("    Source of change event: " + source + ".");
    });
}