addWithSheet method

void addWithSheet(
  1. Worksheet worksheet
)

Add worksheet with name to the collection .

Workbook workbook = new Workbook();
Worksheet sheet = new Worksheet(workbook);
workbook.worksheets.addWithSheet(sheet);
workbook.save('AddWorksheet.xlsx');
workbook.dispose();

Implementation

void addWithSheet(Worksheet worksheet) {
  if (!innerList.contains(worksheet)) {
    worksheet.index = count + 1;
    innerList.add(worksheet);
  }
}