Skip to main content
Row

ChartSheetCollection.Insert(Int32, String, ChartType, CellRange) Method

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

Namespace: DevExpress.Spreadsheet

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

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

ChartSheet Insert(
    int index,
    string name,
    ChartType chartType,
    CellRange range
)

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.

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 created 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 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