Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

ChartOptions.Protection Property

Gets or sets the chart protection.

Namespace: DevExpress.Spreadsheet.Charts

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll

Declaration

ChartProtection Protection { get; set; }

Property Value

Type Description
ChartProtection

A ChartProtection enumeration value containing protection options.

Property Paths

You can access this nested property as listed below:

Object Type Path to Protection
ChartObject
.Options .Protection

Remarks

Use the Protection property to prevent the chart from being modified by the user. Currently, members of the ChartProtection enumeration do not influence the chart protection. Whatever value you select, the chart will be completely locked, so that an end-user cannot select or modify it through the user interface. However, you can access the protected chart in code and apply desired changes programmatically.

Example

The following example demonstrates how to create a clustered column chart and apply chart protection using the ChartOptions.Protection property.

Dim worksheet As Worksheet = workbook.Worksheets("chartTask3")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.ColumnClustered, worksheet("B2:D4"))
chart.TopLeftCell = worksheet.Cells("H2")
chart.BottomRightCell = worksheet.Cells("N14")

' Specify the chart style.
chart.Style = ChartStyle.ColorDark

' Apply the chart protection.
chart.Options.Protection = ChartProtection.All

The following code snippets (auto-collected from DevExpress Examples) contain references to the Protection property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also