Skip to main content
Row

ChartSheetCollection.Add(String, ChartType, CellRange) Method

Creates a new chart sheet under the specified name with the specified chart and appends it to the end of the collection.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

ChartSheet Add(
    string name,
    ChartType chartType,
    CellRange range
)

Parameters

Name Type Description
name String

A String value that specifies the chart sheet name.

chartType ChartType

A ChartType enumeration member specifying the chart type.

range CellRange

A CellRange containing chart data.

Returns

Type Description
ChartSheet

A ChartSheet object that specifies the new chart sheet.

Remarks

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

  • A chart sheet name must not be equal to an existing name in the sheet collection (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 (‘).

If the name parameter is an empty string, a new chart sheet is created under the default name like ChartN, where N is a number that is greater by 1 than the maximum number used in chart sheet names of the same type. To change the chart sheet name, use the ChartSheet.Name property. Use the ChartSheet.Chart property to access a chart located on the chart sheet and fine-tune its settings and adjust the chart appearance.

To insert a new chart sheet to the specified position in the collection, use the ChartSheetCollection.Insert method.

To remove a chart sheet from the collection, use the ChartSheetCollection.Remove or ChartSheetCollection.RemoveAt method.

See Also