WorksheetCollection.Add
Contents
[
Hide
]Add(SheetType)
Adds a worksheet to the collection.
public int Add(SheetType type)
Parameter | Type | Description |
---|---|---|
type | SheetType | Worksheet type. |
Return Value
Worksheet
object index.
Examples
[C#]
Workbook workbook = new Workbook();
workbook.Worksheets.Add(SheetType.Chart);
Cells cells = workbook.Worksheets[0].Cells;
cells["c2"].PutValue(5000);
cells["c3"].PutValue(3000);
cells["c4"].PutValue(4000);
cells["c5"].PutValue(5000);
cells["c6"].PutValue(6000);
ChartCollection charts = workbook.Worksheets[1].Charts;
int chartIndex = charts.Add(ChartType.Column, 10,10,20,20);
Chart chart = charts[chartIndex];
chart.NSeries.Add("Sheet1!C2:C6", true);
[Visual Basic]
Dim workbook As Workbook = New Workbook()
workbook.Worksheets.Add(SheetType.Chart)
Dim cells As Cells = workbook.Worksheets(0).Cells
cells("c2").PutValue(5000)
cells("c3").PutValue(3000)
cells("c4").PutValue(4000)
cells("c5").PutValue(5000)
cells("c6").PutValue(6000)
Dim charts As ChartCollection = workbook.Worksheets(1).Charts
Dim chartIndex As Integer = charts.Add(ChartType.Column,10,10,20,20)
Dim chart As Chart = charts(chartIndex)
chart.NSeries.Add("Sheet1!C2:C6", True)
See Also
- enum SheetType
- class WorksheetCollection
- namespace Aspose.Cells
- assembly Aspose.Cells
Add()
Adds a worksheet to the collection.
public int Add()
Return Value
Worksheet
object index.
See Also
- class WorksheetCollection
- namespace Aspose.Cells
- assembly Aspose.Cells
Add(string)
Adds a worksheet to the collection.
public Worksheet Add(string sheetName)
Parameter | Type | Description |
---|---|---|
sheetName | String | Worksheet name |
Return Value
Worksheet
object.
See Also
- class Worksheet
- class WorksheetCollection
- namespace Aspose.Cells
- assembly Aspose.Cells