Aspose::Cells::WorksheetCollection::Add method

WorksheetCollection::Add(SheetType) method

Adds a worksheet to the collection.

int32_t Aspose::Cells::WorksheetCollection::Add(SheetType type)
ParameterTypeDescription
typeSheetTypeWorksheet type.

ReturnValue

Worksheet object index.

Examples

Aspose::Cells::Startup();
Workbook workbook;
workbook.GetWorksheets().Add(SheetType::Chart);
Cells cells = workbook.GetWorksheets().Get(0).GetCells();
cells.Get(u"c2").PutValue(5000);
cells.Get(u"c3").PutValue(3000);
cells.Get(u"c4").PutValue(4000);
cells.Get(u"c5").PutValue(5000);
cells.Get(u"c6").PutValue(6000);
ChartCollection charts = workbook.GetWorksheets().Get(1).GetCharts();
int chartIndex = charts.Add(ChartType::Column, 10, 10, 20, 20);
Chart chart = charts.Get(chartIndex);
chart.GetNSeries().Add(u"Sheet1!C2:C6", true);
Aspose::Cells::Cleanup();

See Also

WorksheetCollection::Add() method

Adds a worksheet to the collection.

int32_t Aspose::Cells::WorksheetCollection::Add()

ReturnValue

Worksheet object index.

See Also

WorksheetCollection::Add(const U16String&) method

Adds a worksheet to the collection.

Worksheet Aspose::Cells::WorksheetCollection::Add(const U16String &sheetName)
ParameterTypeDescription
sheetNameconst U16String&Worksheet name

ReturnValue

Worksheet object.

See Also

WorksheetCollection::Add(const char16_t*) method

Adds a worksheet to the collection.

Worksheet Aspose::Cells::WorksheetCollection::Add(const char16_t *sheetName)
ParameterTypeDescription
sheetNameconst char16_t*Worksheet name

ReturnValue

Worksheet object.

See Also