Excel.WorksheetProtectionChangedEventArgs interface
Fournit des informations sur la feuille de calcul qui a déclenché l’événement de modification du status de protection, qui se déclenche lorsque le status de protection est mis à jour dans une feuille de calcul.
Remarques
Utilisateur
Propriétés
| allow |
Spécifie si l’un |
| is |
Obtient le status de protection actuel de la feuille de calcul. |
| protection |
Spécifie si les |
| sheet |
Indique si le mot de passe de la feuille de calcul a changé. |
| source | Source de l'événement. Il peut être local ou distant (par le biais de la co-édition). |
| type | Obtient le type de l’événement. Pour |
| worksheet |
Obtient l’ID de la feuille de calcul dans laquelle le status de protection est modifié. |
Détails de la propriété
allowEditRangesChanged
Spécifie si l’un AllowEditRange des objets a changé.
allowEditRangesChanged: boolean;
Valeur de propriété
boolean
Remarques
isProtected
Obtient le status de protection actuel de la feuille de calcul.
isProtected: boolean;
Valeur de propriété
boolean
Remarques
Exemples
// 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
Spécifie si les WorksheetProtectionOptions ont changé.
protectionOptionsChanged: boolean;
Valeur de propriété
boolean
Remarques
sheetPasswordChanged
Indique si le mot de passe de la feuille de calcul a changé.
sheetPasswordChanged: boolean;
Valeur de propriété
boolean
Remarques
source
Source de l'événement. Il peut être local ou distant (par le biais de la co-édition).
source: Excel.EventSource | "Local" | "Remote";
Valeur de propriété
Excel.EventSource | "Local" | "Remote"
Remarques
Exemples
// 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
Obtient le type de l’événement. Pour Excel.EventType plus de détails.
type: "WorksheetProtectionChanged";
Valeur de propriété
"WorksheetProtectionChanged"
Remarques
worksheetId
Obtient l’ID de la feuille de calcul dans laquelle le status de protection est modifié.
worksheetId: string;
Valeur de propriété
string
Remarques
Exemples
// 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 + ".");
});
}