Skip to main content
Row

ChartSheetCollection.Add(String, ChartType) Method

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

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

ChartSheet Add(
    string name,
    ChartType chartType
)

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.

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 specify its settings (select chart data 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