[]
Use this interface to configure which operations remain available on a protected worksheet, such as inserting or deleting rows and columns, filtering, sorting, or editing scenarios. The setting action will take effect only if the worksheet is under protection.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowDeletingColumns(true);
protectionSettings.setAllowDeletingRows(true);
voidbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidsetAllowDeletingColumns(boolean value) voidsetAllowDeletingRows(boolean value) voidsetAllowEditingScenarios(boolean value) voidsetAllowFiltering(boolean value) voidsetAllowFormattingCells(boolean value) voidsetAllowFormattingColumns(boolean value) voidsetAllowFormattingRows(boolean value) voidsetAllowInsertingColumns(boolean value) voidsetAllowInsertingHyperlinks(boolean value) voidsetAllowInsertingRows(boolean value) voidsetAllowSorting(boolean value) voidsetAllowUsingObjects(boolean value) voidsetAllowUsingPivotTables(boolean value) toJson()This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowDeletingColumns(true);
boolean allowDeletingColumns = protectionSettings.getAllowDeletingColumns();
true if deleting columns is allowed on the protected worksheet; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowDeletingColumns(true);
value - true if deleting columns is allowed on the protected worksheet; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowDeletingRows(true);
boolean allowDeletingRows = protectionSettings.getAllowDeletingRows();
true if deleting rows is allowed on the protected worksheet; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowDeletingRows(true);
value - true if deleting rows is allowed on the protected worksheet; otherwise, false.This property indicates whether filtering remains available after worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFiltering(true);
boolean allowFiltering = protectionSettings.getAllowFiltering();
true if the user can use an AutoFilter that was created before the worksheet was protected; otherwise, false.This property indicates whether filtering remains available after worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFiltering(true);
value - true if the user can use an AutoFilter that was created before the worksheet was protected; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFormattingCells(true);
boolean allowFormattingCells = protectionSettings.getAllowFormattingCells();
true if formatting cells is allowed on the protected worksheet; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFormattingCells(true);
value - true if formatting cells is allowed on the protected worksheet; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFormattingColumns(true);
boolean allowFormattingColumns = protectionSettings.getAllowFormattingColumns();
true if formatting columns is allowed on the protected worksheet; otherwise, false.This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFormattingColumns(true);
value - true if formatting columns is allowed on the protected worksheet; otherwise, false.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFormattingRows(true);
boolean allowFormattingRows = protectionSettings.getAllowFormattingRows();
true if formatting rows is allowed on a protected worksheet; otherwise, false.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowFormattingRows(true);
value - true if formatting rows is allowed on a protected worksheet; otherwise, false.This property determines whether users can insert columns while worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowInsertingColumns(true);
boolean allowInsertingColumns = protectionSettings.getAllowInsertingColumns();
true if inserting columns is allowed on a protected worksheet; otherwise, false.This property determines whether users can insert columns while worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowInsertingColumns(true);
value - true if inserting columns is allowed on a protected worksheet; otherwise, false.This property determines whether users can insert rows while worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowInsertingRows(true);
boolean allowInsertingRows = protectionSettings.getAllowInsertingRows();
true if inserting rows is allowed on a protected worksheet; otherwise, false.This property determines whether users can insert rows while worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowInsertingRows(true);
value - true if inserting rows is allowed on a protected worksheet; otherwise, false.This property applies when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowInsertingHyperlinks(true);
boolean allowInsertingHyperlinks = protectionSettings.getAllowInsertingHyperlinks();
true if inserting hyperlinks is allowed on the protected worksheet; otherwise, false.This property applies when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowInsertingHyperlinks(true);
value - true if inserting hyperlinks is allowed on the protected worksheet; otherwise, false.This property indicates whether users can sort ranges when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowSorting(true);
boolean allowSorting = protectionSettings.getAllowSorting();
true if sorting is allowed on the protected worksheet; otherwise, false.This property indicates whether users can sort ranges when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowSorting(true);
value - true if sorting is allowed on the protected worksheet; otherwise, false.This property indicates whether users can work with pivot tables when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowUsingPivotTables(true);
boolean allowUsingPivotTables = protectionSettings.getAllowUsingPivotTables();
true if using pivot tables is allowed on the protected worksheet; otherwise, false.This property indicates whether users can work with pivot tables when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowUsingPivotTables(true);
value - true if using pivot tables is allowed on the protected worksheet; otherwise, false.Drawing objects include shapes, charts, pictures, text boxes, and controls. This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowUsingObjects(true);
boolean allowUsingObjects = protectionSettings.getAllowUsingObjects();
true if the user is allowed to select and edit drawing objects on the protected worksheet; otherwise, false.Drawing objects include shapes, charts, pictures, text boxes, and controls. This setting is meaningful only when worksheet protection is enabled.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowUsingObjects(true);
value - true to allow the user to select and edit drawing objects on the protected worksheet; otherwise, false.This property indicates whether scenario editing is permitted when worksheet protection is enabled. Use setAllowEditingScenarios(boolean) to change this setting.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowEditingScenarios(true);
boolean allowEditingScenarios = protectionSettings.getAllowEditingScenarios();
true if the user is allowed to edit scenarios on a protected worksheet; otherwise, false. The default value is false.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowEditingScenarios(true);
value - true if the user is allowed to edit scenarios on a protected worksheet; otherwise, false. The default value is false.Use this method to update the current IProtectionSettings instance from a JSON string produced by toJson(). The configured settings take effect only when the worksheet is protected.
IProtectionSettings source = worksheet.getProtectionSettings();
source.setAllowSorting(true);
String json = source.toJson();
IWorksheet targetSheet = workbook.getWorksheets().add();
IProtectionSettings target = targetSheet.getProtectionSettings();
target.fromJson(json);
targetSheet.setProtection(true);
json - The JSON string representing worksheet protection settings.Use this method to serialize the current IProtectionSettings values so that they can be reused with fromJson(String). The serialized content represents worksheet protection options.
worksheet.setProtection(true);
IProtectionSettings protectionSettings = worksheet.getProtectionSettings();
protectionSettings.setAllowDeletingColumns(true);
String json = protectionSettings.toJson();