Excel.WorksheetProtectionChangedEventArgs interface

Proporciona información sobre la hoja de cálculo que generó el evento de cambio de estado de protección, que se desencadena cuando el estado de protección se actualiza en una hoja de cálculo.

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Propiedades

allowEditRangesChanged

Especifica si alguno de los AllowEditRange objetos ha cambiado.

isProtected

Obtiene el estado de protección actual de la hoja de cálculo.

protectionOptionsChanged

Especifica si ha WorksheetProtectionOptions cambiado.

sheetPasswordChanged

Especifica si la contraseña de la hoja de cálculo ha cambiado.

source

Origen del evento. Puede ser local o remota (a través de la coautoría).

type

Obtiene el tipo del evento. Vea Excel.EventType para más información.

worksheetId

Obtiene el identificador de la hoja de cálculo en la que se cambia el estado de protección.

Detalles de las propiedades

allowEditRangesChanged

Especifica si alguno de los AllowEditRange objetos ha cambiado.

allowEditRangesChanged: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApiOnline 1.1 ]

isProtected

Obtiene el estado de protección actual de la hoja de cálculo.

isProtected: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

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

Especifica si ha WorksheetProtectionOptions cambiado.

protectionOptionsChanged: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApiOnline 1.1 ]

sheetPasswordChanged

Especifica si la contraseña de la hoja de cálculo ha cambiado.

sheetPasswordChanged: boolean;

Valor de propiedad

boolean

Comentarios

[ Conjunto de API: ExcelApiOnline 1.1 ]

source

Origen del evento. Puede ser local o remota (a través de la coautoría).

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

Valor de propiedad

Excel.EventSource | "Local" | "Remote"

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

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

Obtiene el tipo del evento. Vea Excel.EventType para más información.

type: "WorksheetProtectionChanged";

Valor de propiedad

"WorksheetProtectionChanged"

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

worksheetId

Obtiene el identificador de la hoja de cálculo en la que se cambia el estado de protección.

worksheetId: string;

Valor de propiedad

string

Comentarios

[ Conjunto de API: ExcelApi 1.14 ]

Ejemplos

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