Operation Restrictions
- 4 minutes to read
Use the SpreadsheetControlOptions.Behavior property to access the Spreadsheet control’s restriction settings. You can set these options to the following values:
DocumentCapability.Default or DocumentCapability.Enabled - permits the specified spreadsheet operation.
DocumentCapability.Disabled - restricts the specified spreadsheet operation and disables the corresponding items in the control’s ribbon UI and context menus.
DocumentCapability.Hidden - restricts the specified spreadsheet operation and hides the corresponding items in the control’s ribbon UI and context menus.
#Disable Workbook Operations
Use the following properties to restrict operations users can perform on workbooks:
Restriction | Description |
---|---|
Spreadsheet |
Specifies whether users can create new documents. |
Spreadsheet |
Specifies whether users can open documents. |
Spreadsheet |
Specifies whether users can drag and drop files onto the Spreadsheet control. |
Spreadsheet |
Specifies whether users can save changes in an existing document. |
Spreadsheet |
Specifies whether users can save new documents. |
Spreadsheet |
Specifies whether users can protect workbooks. |
Spreadsheet |
Specifies whether users can remove workbook protection. |
Spreadsheet |
Specifies whether users can encrypt documents with a password. |
Spreadsheet |
Specifies whether users can print documents. |
The example below shows how to disable the New and Open operations in the Spreadsheet control.
<dxsps:SpreadsheetControl.Options>
<dxsps:SpreadsheetControlOptions>
<dxsps:SpreadsheetControlOptions.Behavior>
<dxsps:SpreadsheetBehaviorOptions Open="Disabled" CreateNew="Disabled"/>
</dxsps:SpreadsheetControlOptions.Behavior>
</dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>
#Disable Worksheet Operations
Use the following properties to restrict operations users can perform on worksheets:
Restriction | Description |
---|---|
Spreadsheet |
Specifies whether users can insert worksheets. |
Spreadsheet |
Specifies whether users can delete worksheets. |
Spreadsheet |
Specifies whether users can hide worksheets. |
Spreadsheet |
Specifies whether users can unhide worksheets. |
Spreadsheet |
Specifies whether users can rename worksheets. |
Spreadsheet |
Specifies whether users can protect worksheets. |
Spreadsheet |
Specifies whether users can remove worksheet protection. |
Spreadsheet |
Specifies whether users can apply a background color to sheet tabs. |
Spreadsheet |
Specifies whether users can zoom in and out of worksheets. |
Spreadsheet |
Defines the maximum zoom factor. |
Spreadsheet |
Defines the minimum zoom factor. |
The example below shows how to hide the Delete Sheet and Hide Sheet commands in the Spreadsheet control.
<dxsps:SpreadsheetControl.Options>
<dxsps:SpreadsheetControlOptions>
<dxsps:SpreadsheetControlOptions.Behavior>
<dxsps:SpreadsheetBehaviorOptions>
<dxsps:SpreadsheetBehaviorOptions.Worksheet>
<dxsps:SpreadsheetWorksheetBehaviorOptions Delete="Hidden" Hide="Hidden"/>
</dxsps:SpreadsheetBehaviorOptions.Worksheet>
</dxsps:SpreadsheetBehaviorOptions>
</dxsps:SpreadsheetControlOptions.Behavior>
</dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>
#Disable Row and Column Operations
Use the following properties to restrict operations users can perform on rows and columns:
Restriction | Description |
---|---|
Spreadsheet |
Specifies whether users can insert rows. |
Spreadsheet |
Specifies whether users can delete rows. |
Spreadsheet |
Specifies whether users can hide rows. |
Spreadsheet |
Specifies whether users can unhide rows. |
Spreadsheet |
Specifies whether users can resize rows. |
Spreadsheet |
Specifies whether users can use Auto |
Spreadsheet |
Specifies whether users can insert columns. |
Spreadsheet |
Specifies whether users can delete columns. |
Spreadsheet |
Specifies whether users can hide columns. |
Spreadsheet |
Specifies whether users can unhide columns. |
Spreadsheet |
Specifies whether users can resize columns. |
Spreadsheet |
Specifies whether users can use Auto |
Spreadsheet |
Specifies whether users can freeze rows and columns. |
Spreadsheet |
Specifies whether users can group or ungroup rows and columns. |
The example below shows how to disable the Delete operation for row and columns in the Spreadsheet control.
<dxsps:SpreadsheetControl.Options>
<dxsps:SpreadsheetControlOptions>
<dxsps:SpreadsheetControlOptions.Behavior>
<dxsps:SpreadsheetBehaviorOptions>
<dxsps:SpreadsheetBehaviorOptions.Row>
<dxsps:SpreadsheetRowBehaviorOptions Delete="Disabled"/>
</dxsps:SpreadsheetBehaviorOptions.Row>
<dxsps:SpreadsheetBehaviorOptions.Column>
<dxsps:SpreadsheetColumnBehaviorOptions Delete="Disabled"/>
</dxsps:SpreadsheetBehaviorOptions.Column>
</dxsps:SpreadsheetBehaviorOptions>
</dxsps:SpreadsheetControlOptions.Behavior>
</dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>
#Disable Cell Operations
Use the following properties to restrict operations users can perform on cells and cell ranges:
Restriction | Description |
---|---|
Spreadsheet |
Specifies whether users can drag cell ranges, drawings objects, and comments. |
Spreadsheet |
Specifies whether users can move cell ranges. |
Spreadsheet |
Allows you to show or hide the fill handle. |
Spreadsheet |
Specifies whether the Cell |
Spreadsheet |
Specifies whether users can use the mouse or arrow keys to extend the cell selection. |
Spreadsheet |
Specifies whether users can select multiple cell ranges or drawing objects in a worksheet. |
Spreadsheet |
Specifies whether to highlight the selected cells in the Spreadsheet control. |
Spreadsheet |
Specifies the direction in which an active cell moves when the ENTER key is pressed. |
Spreadsheet |
Specifies whether to highlight selection when the Spreadsheet control does not have focus. |
Spreadsheet |
Specifies whether users can grant permission to specific users to edit ranges in a protected worksheet. |
Spreadsheet |
Specifies whether users can create or modify data validation rules. |
Spreadsheet |
Specifies whether users can create or modify comments. |
The example below shows how to disable multiple selection in the Spreadsheet control and change the direction in which an active cell moves when a user presses ENTER.
<dxsps:SpreadsheetControl.Options>
<dxsps:SpreadsheetControlOptions>
<dxsps:SpreadsheetControlOptions.Behavior>
<dxsps:SpreadsheetBehaviorOptions>
<dxsps:SpreadsheetBehaviorOptions.Selection>
<dxsps:SpreadsheetSelectionBehaviorOptions AllowMultiSelection="False" MoveActiveCellMode="Right"/>
</dxsps:SpreadsheetBehaviorOptions.Selection>
</dxsps:SpreadsheetBehaviorOptions>
</dxsps:SpreadsheetControlOptions.Behavior>
</dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>
#Disable Clipboard Operations
Use the following properties to restrict clipboard operations:
Restriction | Description |
---|---|
Spreadsheet |
Specifies whether users can perform the Cut operation. |
Spreadsheet |
Specifies whether users can perform the Copy operation. |
Spreadsheet |
Specifies whether users can perform the Paste operation. |
The example below shows how to disable clipboard operations in the Spreadsheet control.
<dxsps:SpreadsheetControl.Options>
<dxsps:SpreadsheetControlOptions>
<dxsps:SpreadsheetControlOptions.Behavior>
<dxsps:SpreadsheetBehaviorOptions Cut="Disabled" Copy="Disabled" Paste="Disabled"/>
</dxsps:SpreadsheetControlOptions.Behavior>
</dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>