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
is |
Obtiene el estado de protección actual de la hoja de cálculo. |
source | Origen del evento. Puede ser local o remota (a través de la coautoría). |
type | Obtiene el tipo del evento. Vea |
worksheet |
Obtiene el identificador de la hoja de cálculo en la que se cambia el estado de protección. |
Detalles de las propiedades
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 + ".");
});
}
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
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 + ".");
});
}