// Create a new workbook Workbook workbook = new Workbook(); IWorksheet worksheet = workbook.getWorksheets().get(0); //Set data. worksheet.getRange("A1:C3").setValue(new Object[][] { {"BUDGET TOTALS", "ESTIMATED", "ACTUAL"}, {"Income", 63300, 57450}, {"Expenses", 54500, 49630} }); //Set style. worksheet.getRange("B2:C3").setNumberFormat("$#,##0"); worksheet.getColumns().get(0).setColumnWidth(17); worksheet.getColumns().get(1).setColumnWidth(13); worksheet.getColumns().get(2).setColumnWidth(10); worksheet.getRange("A1:C3").getBorders().get(BordersIndex.InsideHorizontal).setColor(Color.GetWhite()); worksheet.getRange("A1:C3").getBorders().get(BordersIndex.InsideVertical).setColor(Color.GetWhite()); worksheet.getRange("A1:C1").getInterior().setColor(Color.FromArgb(255, 217, 102)); worksheet.getRange("A2:C3").getInterior().setColor(Color.FromArgb(237, 237, 237)); //Create chart. IShape shape = worksheet.getShapes().addChart(ChartType.ColumnClustered, 250, 0, 350, 250); shape.getChart().getSeriesCollection().add(worksheet.getRange("A1:C3")); shape.getChart().getChartTitle().setText("Estimated vs Actual"); //Display the data table. shape.getChart().setHasDataTable(true); //Config the data table. IDataTable datatable = shape.getChart().getDataTable(); datatable.getFormat().getLine().getColor().setObjectThemeColor(ThemeColor.Accent6); datatable.getFont().getColor().setObjectThemeColor(ThemeColor.Accent2); datatable.getFont().setSize(9); // Save to an excel file workbook.save("ChartDataTable.xlsx");