Skip to main content
Row

ChartSheetCollection.Insert(Int32, String) Method

Creates a new chart sheet under the specified name and appends it to the collection at the specified position.

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

ChartSheet Insert(
    int index,
    string name
)

Parameters

Name Type Description
index Int32

A zero-based integer which specifies the position at which a new chart sheet should be inserted.

name String

A String value that specifies the chart sheet name.

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, change the chart type and adjust its appearance). By default, a chart sheet created by the current Insert method overload contains an empty chart of the ChartType.ColumnClustered type.

To insert a new chart sheet at the end of the collection, use the ChartSheetCollection.Add method.

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

See Also