// Instantiate a Workbook object Workbook workbook; // Obtaining the reference of the default(first) worksheet Worksheet worksheet = workbook.GetWorksheets().Get(0); // Obtaining Worksheet's cells collection Cells cells = worksheet.GetCells(); // Setting the value to the cells cells.Get("A1").PutValue(u"Employee"); cells.Get("B1").PutValue(u"Quarter"); cells.Get("C1").PutValue(u"Product"); cells.Get("D1").PutValue(u"Continent"); cells.Get("E1").PutValue(u"Country"); cells.Get("F1").PutValue(u"Sale"); cells.Get("A2").PutValue(u"David"); cells.Get("A3").PutValue(u"David"); cells.Get("A4").PutValue(u"David"); cells.Get("A5").PutValue(u"David"); cells.Get("A6").PutValue(u"James"); cells.Get("B2").PutValue(1); cells.Get("B3").PutValue(2); cells.Get("B4").PutValue(3); cells.Get("B5").PutValue(4); cells.Get("B6").PutValue(1); cells.Get("C2").PutValue(u"Maxilaku"); cells.Get("C3").PutValue(u"Maxilaku"); cells.Get("C4").PutValue(u"Chai"); cells.Get("C5").PutValue(u"Maxilaku"); cells.Get("C6").PutValue(u"Chang"); cells.Get("D2").PutValue(u"Asia"); cells.Get("D3").PutValue(u"Asia"); cells.Get("D4").PutValue(u"Asia"); cells.Get("D5").PutValue(u"Asia"); cells.Get("D6").PutValue(u"Europe"); cells.Get("E2").PutValue(u"China"); cells.Get("E3").PutValue(u"India"); cells.Get("E4").PutValue(u"Korea"); cells.Get("E5").PutValue(u"India"); cells.Get("E6").PutValue(u"France"); cells.Get("F2").PutValue(2000); cells.Get("F3").PutValue(500); cells.Get("F4").PutValue(1200); cells.Get("F5").PutValue(1500); cells.Get("F6").PutValue(500); // Adding a new List Object to the worksheet worksheet.GetListObjects().Add(u"A1", u"F6", true); ListObject listObject = worksheet.GetListObjects().Get(0); // Adding Default Style to the table listObject.SetTableStyleType(TableStyleType::TableStyleMedium10); // Show Total listObject.SetShowTotals(true); // Saving the Excel file workbook.Save(resultPath + u"Excel_Table.xlsx");