Back to Devexpress

ChartObject.CopyTo(Worksheet) Method

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-chartobject-dot-copyto-x28-devexpress-dot-spreadsheet-dot-worksheet-x29.md

latest2.0 KB
Original Source

ChartObject.CopyTo(Worksheet) Method

Creates a copy of the chart in another worksheet.

Namespace : DevExpress.Spreadsheet.Charts

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
Chart CopyTo(
    Worksheet worksheet
)
vb
Function CopyTo(
    worksheet As Worksheet
) As Chart

Parameters

NameTypeDescription
worksheetWorksheet

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

|

Returns

TypeDescription
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

ChartObject Interface

ChartObject Members

DevExpress.Spreadsheet.Charts Namespace