// Create a new workbook Workbook workbook = new Workbook(); //Load template file from resource InputStream templateFile = this.getResourceStream("xlsx/CombinedFilter.xlsx"); workbook.open(templateFile); Workbook dataWorkbook = new Workbook(); dataWorkbook.open(this.getResourceStream("data/orderData.xlsx"), OpenFileFormat.Xlsx); // Each sheet in the dataWorkbook is a data source. for (IWorksheet worksheet : dataWorkbook.getWorksheets()) { ITableDataSource datasource = new SheetTable(worksheet); workbook.addDataSource(worksheet.getName(), datasource); } //Invoke to process the template workbook.processTemplate(); workbook.getWorksheets().get(0).getRange("A:F").setColumnWidth(16); workbook.getWorksheets().get(0).getRange("A3").clearComments(); // Save to an excel file workbook.save("CombinedFilter.xlsx");