The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
Row

ChartSheet.Protect(String, ChartSheetProtection) Method

Protects chart sheet elements to prevent them from being changed by the user.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v19.1.Core.dll

Declaration

void Protect(
    string password,
    ChartSheetProtection options
)
Sub Protect(
    password As String,
    options As ChartSheetProtection
)
void Protect(
    string password,
    ChartSheetProtection options
)
Sub Protect(
    password As String,
    options As ChartSheetProtection
)

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.

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

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