Freigeben über


Excel.WorksheetProtectionChangedEventArgs interface

Stellt Informationen zu dem Arbeitsblatt bereit, das das Ereignis "Schutzstatusänderung" ausgelöst hat, das ausgelöst wird, wenn der Schutzstatus in einem Arbeitsblatt aktualisiert wird.

Hinweise

[ API-Satz: ExcelApi 1.14 ]

Eigenschaften

isProtected

Ruft den aktuellen Schutzstatus des Arbeitsblatts ab.

source

Die Quelle des Ereignisses. Dies kann lokal oder remote sein (durch gemeinsame Dokumenterstellung).

type

Ruft den Typ des Ereignisses ab. Weitere Informationen finden Sie unter Excel.EventType .

worksheetId

Ruft die ID des Arbeitsblatts ab, in dem der Schutzstatus geändert wird.

Details zur Eigenschaft

isProtected

Ruft den aktuellen Schutzstatus des Arbeitsblatts ab.

isProtected: boolean;

Eigenschaftswert

boolean

Hinweise

[ API-Satz: ExcelApi 1.14 ]

Beispiele

// 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 + ".");
    });
}

source

Die Quelle des Ereignisses. Dies kann lokal oder remote sein (durch gemeinsame Dokumenterstellung).

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

Eigenschaftswert

Excel.EventSource | "Local" | "Remote"

Hinweise

[ API-Satz: ExcelApi 1.14 ]

Beispiele

// 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

Ruft den Typ des Ereignisses ab. Weitere Informationen finden Sie unter Excel.EventType .

type: "WorksheetProtectionChanged";

Eigenschaftswert

"WorksheetProtectionChanged"

Hinweise

[ API-Satz: ExcelApi 1.14 ]

worksheetId

Ruft die ID des Arbeitsblatts ab, in dem der Schutzstatus geändert wird.

worksheetId: string;

Eigenschaftswert

string

Hinweise

[ API-Satz: ExcelApi 1.14 ]

Beispiele

// 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 + ".");
    });
}