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+

ChartObject.MoveToNewChartSheet(String) Method

Moves the current chart to a separate chart sheet.

Namespace: DevExpress.Spreadsheet.Charts

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

Declaration

ChartSheet MoveToNewChartSheet(string name)
Function MoveToNewChartSheet(name As String) As ChartSheet
ChartSheet MoveToNewChartSheet(string name)
Function MoveToNewChartSheet(name As String) As ChartSheet

Parameters

Name Type Description
name String

A String value that specifies the name of the new chart sheet.

Parameters

Name Type Description
name String

A String value that specifies the name of the new chart sheet.

Returns

Type Description
ChartSheet

A newly created ChartSheet or null (Nothing in Visual Basic), if a chart sheet cannot be created.

Returns

Type Description
ChartSheet

A newly created ChartSheet or null (Nothing in Visual Basic), if a chart sheet cannot be created.

Remarks

When naming a chart sheet, take into account the following constraints:

  • A chart sheet name must not be equal to a name that is already contained in the collection of existing sheets (IWorkbook.Sheets).
  • A chart sheet name must not exceed 31 characters.
  • A chart sheet name must not contain the following symbols: , /, ?, :, *, [ or ]
  • A chart sheet name must not start and end with a single quote (').
  • A chart sheet name must not be an empty string.

Examples

The following example demonstrates how to move an existing chart from a worksheet to a separate chart sheet. To do this, call the ChartObject.MoveToNewChartSheet method for a chart you wish to move.

To transfer a chart back to the worksheet containing the source data, use the ChartObject.MoveToWorksheet method.

Dim worksheet As Worksheet = workbook.Worksheets("chartTask1")

' Create an embedded chart on the worksheet.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Pie, worksheet("B2:C7"))
chart.TopLeftCell = worksheet.Cells("E2")
chart.BottomRightCell = worksheet.Cells("K15")

' Move the chart to a chart sheet.
Dim chartSheet As ChartSheet = chart.MoveToNewChartSheet("Chart")

workbook.ChartSheets.ActiveChartSheet = chartSheet
See Also