export class AppComponent { constructor() { } @ViewChild('default') public spreadsheetObj!: SpreadsheetComponent; public data: Object[] = getDefaultData(); created() { this.spreadsheetObj.cellFormat( { fontWeight: 'bold', textAlign: 'center', verticalAlign: 'middle' }, 'A1:F1' ); //To protect the worksheet. let protectSetting: ProtectSettingsModel = { selectCells: true, selectUnLockedCells: true }; this.spreadsheetObj.protectSheet('Car Sales Report', protectSetting); const unlockedRanges = ['H10', 'H11', 'H12', 'H13', 'H14', 'H15', 'H16']; // Specify the ranges or cells you want to unlock unlockedRanges.forEach((range: any) => { if (this.spreadsheetObj) { this.spreadsheetObj.lockCells(range, false); } }); } dialogBeforeOpen(args: DialogBeforeOpenEventArgs) { // Checking whether dialog protect sheet if (args.dialogName === "EditAlertDialog" ) { args.cancel = true; } } } |