Skip to main content

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:

Disable Workbook Operations

Use the following properties to restrict operations users can perform on workbooks:

Restriction Description
SpreadsheetBehaviorOptions.CreateNew Specifies whether users can create new documents.
SpreadsheetBehaviorOptions.Open Specifies whether users can open documents.
SpreadsheetBehaviorOptions.Drop Specifies whether users can drag and drop files onto the Spreadsheet control.
SpreadsheetBehaviorOptions.Save Specifies whether users can save changes in an existing document.
SpreadsheetBehaviorOptions.SaveAs Specifies whether users can save new documents.
SpreadsheetProtectionBehaviorOptions.ProtectWorkbook Specifies whether users can protect workbooks.
SpreadsheetProtectionBehaviorOptions.UnprotectWorkbook Specifies whether users can remove workbook protection.
SpreadsheetBehaviorOptions.Encrypt Specifies whether users can encrypt documents with a password.
SpreadsheetBehaviorOptions.Print Specifies whether users can print documents.

The example below shows how to disable the New and Open operations in the Spreadsheet control.

Disable_Workbook_Operations

<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
SpreadsheetWorksheetBehaviorOptions.Insert Specifies whether users can insert worksheets.
SpreadsheetWorksheetBehaviorOptions.Delete Specifies whether users can delete worksheets.
SpreadsheetWorksheetBehaviorOptions.Hide Specifies whether users can hide worksheets.
SpreadsheetWorksheetBehaviorOptions.Unhide Specifies whether users can unhide worksheets.
SpreadsheetWorksheetBehaviorOptions.Rename Specifies whether users can rename worksheets.
SpreadsheetProtectionBehaviorOptions.ProtectSheet Specifies whether users can protect worksheets.
SpreadsheetProtectionBehaviorOptions.UnprotectSheet Specifies whether users can remove worksheet protection.
SpreadsheetWorksheetBehaviorOptions.TabColor Specifies whether users can apply a background color to sheet tabs.
SpreadsheetBehaviorOptions.Zoom Specifies whether users can zoom in and out of worksheets.
SpreadsheetBehaviorOptions.MaxZoomFactor Defines the maximum zoom factor.
SpreadsheetBehaviorOptions.MinZoomFactor Defines the minimum zoom factor.

The example below shows how to hide the Delete Sheet and Hide Sheet commands in the Spreadsheet control.

Disable_Worksheet_Operations

<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
SpreadsheetRowBehaviorOptions.Insert Specifies whether users can insert rows.
SpreadsheetRowBehaviorOptions.Delete Specifies whether users can delete rows.
SpreadsheetRowBehaviorOptions.Hide Specifies whether users can hide rows.
SpreadsheetRowBehaviorOptions.Unhide Specifies whether users can unhide rows.
SpreadsheetRowBehaviorOptions.Resize Specifies whether users can resize rows.
SpreadsheetRowBehaviorOptions.AutoFit Specifies whether users can use AutoFit for rows.
SpreadsheetColumnBehaviorOptions.Insert Specifies whether users can insert columns.
SpreadsheetColumnBehaviorOptions.Delete Specifies whether users can delete columns.
SpreadsheetColumnBehaviorOptions.Hide Specifies whether users can hide columns.
SpreadsheetColumnBehaviorOptions.Unhide Specifies whether users can unhide columns.
SpreadsheetColumnBehaviorOptions.Resize Specifies whether users can resize columns.
SpreadsheetColumnBehaviorOptions.AutoFit Specifies whether users can use AutoFit for columns.
SpreadsheetBehaviorOptions.FreezePanes Specifies whether users can freeze rows and columns.
SpreadsheetBehaviorOptions.Group 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.

Disable_Row_Column_Operations

<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
SpreadsheetBehaviorOptions.Drag Specifies whether users can drag cell ranges, drawings objects, and comments.
SpreadsheetBehaviorOptions.MoveRange Specifies whether users can move cell ranges.
SpreadsheetBehaviorOptions.FillHandleEnabled Allows you to show or hide the fill handle.
SpreadsheetBehaviorOptions.CellEditorCommitMode Specifies whether the CellValueChanged event should occur each time a user edits a cell value or only if a value was changed.
SpreadsheetSelectionBehaviorOptions.AllowExtendSelection Specifies whether users can use the mouse or arrow keys to extend the cell selection.
SpreadsheetSelectionBehaviorOptions.AllowMultiSelection Specifies whether users can select multiple cell ranges or drawing objects in a worksheet.
SpreadsheetSelectionBehaviorOptions.HideSelection Specifies whether to highlight the selected cells in the Spreadsheet control.
SpreadsheetSelectionBehaviorOptions.MoveActiveCellMode Specifies the direction in which an active cell moves when the ENTER key is pressed.
SpreadsheetSelectionBehaviorOptions.ShowSelectionMode Specifies whether to highlight selection when the Spreadsheet control does not have focus.
SpreadsheetProtectionBehaviorOptions.AllowUsersToEditRange Specifies whether users can grant permission to specific users to edit ranges in a protected worksheet.
SpreadsheetBehaviorOptions.DataValidation Specifies whether users can create or modify data validation rules.
SpreadsheetBehaviorOptions.Comment 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
SpreadsheetBehaviorOptions.Cut Specifies whether users can perform the Cut operation.
SpreadsheetBehaviorOptions.Copy Specifies whether users can perform the Copy operation.
SpreadsheetBehaviorOptions.Paste Specifies whether users can perform the Paste operation.

The example below shows how to disable clipboard operations in the Spreadsheet control.

Disable_Clipboard_Operations

<dxsps:SpreadsheetControl.Options>
    <dxsps:SpreadsheetControlOptions>
        <dxsps:SpreadsheetControlOptions.Behavior>
            <dxsps:SpreadsheetBehaviorOptions Cut="Disabled" Copy="Disabled" Paste="Disabled"/>
        </dxsps:SpreadsheetControlOptions.Behavior>
    </dxsps:SpreadsheetControlOptions>
</dxsps:SpreadsheetControl.Options>
See Also