[]
        
(Showing Draft Content)

创建worksheet

该例子展示了GcExcel与Apache POI创建worksheet的代码


GcExcel 创建worksheet

//GcExcel 创建worksheet
Workbook wb = new Workbook();
wb.getWorksheets().add();
wb.save("TestOutput/GcExcel/Workbook.xlsx");

POI 创建worksheet

//POI 创建worksheet
Workbook wb = new XSSFWorkbook();
Sheet sheet1 = wb.createSheet("sheet1");
Sheet sheet2 = wb.createSheet("sheet2");
try (OutputStream fileOut = new FileOutputStream("TestOutput/Poi/Workbook.xlsx")) {
    wb.write(fileOut);
} catch (IOException e) {
    throw new RuntimeException(e);
}