ChartSheet.Protect(String, ChartSheetProtection) Method
Protects chart sheet elements to prevent them from being changed by the user.
Namespace: DevExpress.Spreadsheet
Assembly: DevExpress.Spreadsheet.v20.2.Core.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
password | String | A string that specifies a password for the chart sheet. If the password is an empty string, the chart sheet can be unprotected without using a password. |
options | ChartSheetProtection | A ChartSheetProtection enumeration member that allows you to specify chart sheet elements to protect. |
Remarks
If a chart sheet is already protected, the Protect method throws an exception. Check the ChartSheet.IsProtected property before calling the method.
Examples
NOTE
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-spreadsheet-chart-api-e5222
Dim worksheet As Worksheet = workbook.Worksheets("chartTask1")
' Create a chart sheet containing a pie chart.
Dim chartSheet As ChartSheet = workbook.ChartSheets.Add(ChartType.Pie, worksheet("B2:C7"))
' Protect the chart sheet. Prevent end-users from making changes to chart elements.
If Not chartSheet.IsProtected Then
chartSheet.Protect("password", ChartSheetProtection.Default)
End If
workbook.ChartSheets.ActiveChartSheet = chartSheet
See Also
Feedback