.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+

ChartObject.CopyTo(Worksheet) Method

Creates a copy of the chart in another worksheet.

Namespace: DevExpress.Spreadsheet.Charts

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

Declaration

Chart CopyTo(
    Worksheet worksheet
)

Parameters

Name Type Description
worksheet Worksheet

A Worksheet object that is the destination worksheet for copying a chart.

Returns

Type Description
Chart

A newly created Chart or null (Nothing in Visual Basic), if the chart cannot be copied.

Remarks

A chart cannot be copied to the same worksheet using the CopyTo method.

You can copy a chart to a worksheet in another workbook if the source and destination worksheets have different internal IDs (defined in OpenXML standard as sheetId element).

All cell references used to specify chart data, labels etc. are copied unchanged. If a cell reference is invalid in a newly created chart (e.g., if a destination workbook does not contain a worksheet with the name used in a reference), an exception is thrown.

See Also