officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-chartobject-dot-movetonewchartsheet-x28-system-dot-string-x29.md
Moves the current chart to a separate chart sheet.
Namespace : DevExpress.Spreadsheet.Charts
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
ChartSheet MoveToNewChartSheet(
string name
)
Function MoveToNewChartSheet(
name As String
) As ChartSheet
| Name | Type | Description |
|---|---|---|
| name | String |
A String value that specifies the name of the new chart sheet.
|
| Type | Description |
|---|---|
| ChartSheet |
A newly created ChartSheet or null ( Nothing in Visual Basic), if a chart sheet cannot be created.
|
When naming a chart sheet, take into account the following constraints:
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.
Worksheet worksheet = workbook.Worksheets["chartTask1"];
// Create an embedded chart on the worksheet.
Chart 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.
ChartSheet chartSheet = chart.MoveToNewChartSheet("Chart");
workbook.ChartSheets.ActiveChartSheet = chartSheet;
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
The following code snippets (auto-collected from DevExpress Examples) contain references to the MoveToNewChartSheet(String) method.
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.
wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/ChartSheetActions.cs#L95
// Move the chart to a chart sheet.
ChartSheet chartSheet = chart.MoveToNewChartSheet("Chart");
winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/ChartSheetActions.cs#L95
// Move the chart to a chart sheet.
ChartSheet chartSheet = chart.MoveToNewChartSheet("Chart");
wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/ChartSheetActions.vb#L92
' Move the chart to a chart sheet.
Dim chartSheet As ChartSheet = chart.MoveToNewChartSheet("Chart")
winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/ChartSheetActions.vb#L91
' Move the chart to a chart sheet.
Dim chartSheet As ChartSheet = chart.MoveToNewChartSheet("Chart")
See Also