Back to Devexpress

ChartSheetCollection.RemoveAt(Int32) Method

officefileapi-devexpress-dot-spreadsheet-dot-chartsheetcollection-dot-removeat-x28-system-dot-int32-x29.md

latest5.2 KB
Original Source

ChartSheetCollection.RemoveAt(Int32) Method

Removes the chart sheet at the specified position from the collection.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void RemoveAt(
    int index
)
vb
Sub RemoveAt(
    index As Integer
)

Parameters

NameTypeDescription
indexInt32

An integer that is the zero-based index of a chart sheet to be deleted from a workbook.

|

Remarks

The RemoveAt method disposes of an element removed from the collection. To remove the specified chart sheet from the collection, use the ChartSheetCollection.Remove method. You can also hide a chart sheet using the ChartSheet.Visible or ChartSheet.VisibilityType property.

Note

A workbook must always contain at least one visible sheet.

To add a chart sheet to a workbook, use the ChartSheetCollection.Add or ChartSheetCollection.Insert method.

Example

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask1"];

// Create the first chart sheet.
workbook.ChartSheets.Add();

// Create the second chart sheet.
workbook.ChartSheets.Add(ChartType.Pie, worksheet["B2:C7"]);

// Remove the first chart sheet.
workbook.ChartSheets.RemoveAt(0);
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask1")

' Create the first chart sheet.
workbook.ChartSheets.Add()

' Create the second chart sheet.
workbook.ChartSheets.Add(ChartType.Pie, worksheet("B2:C7"))

' Remove the first chart sheet.
workbook.ChartSheets.RemoveAt(0)

The following code snippets (auto-collected from DevExpress Examples) contain references to the RemoveAt(Int32) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/ChartSheetActions.cs#L80

csharp
// Remove the first chart sheet.
workbook.ChartSheets.RemoveAt(0);
#endregion #RemoveChartSheet

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/ChartSheetActions.cs#L80

csharp
// Remove the first chart sheet.
workbook.ChartSheets.RemoveAt(0);
#endregion #RemoveChartSheet

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/ChartSheetActions.vb#L78

vb
' Remove the first chart sheet.
            workbook.ChartSheets.RemoveAt(0)
' #End Region ' #RemoveChartSheet

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/ChartSheetActions.vb#L77

vb
' Remove the first chart sheet.
workbook.ChartSheets.RemoveAt(0)
' #End Region ' #RemoveChartSheet

See Also

Remove(ChartSheet)

Add

Insert

ChartSheetCollection Interface

ChartSheetCollection Members

DevExpress.Spreadsheet Namespace