内容纲要
        File excel = FileUtil.touch(file + yesterday + ".xlsx");
        FileOutputStream out = new FileOutputStream(excel);
        SXSSFWorkbook workbook = new SXSSFWorkbook();
        // 创建工作表
        workbook.createSheet("分佣数据");
        workbook.write(out);
        workbook.close();
        //清理临时文件
        workbook.dispose();
        out.close();

        ExcelWriter writer = ExcelUtil.getWriter(excel, "分佣数据");
        //自定义标题别名
        writer.addHeaderAlias("busiscen", "业务场景").setColumnWidth(0,16);
        writer.addHeaderAlias("currency", "币种").setColumnWidth(1,16);
        writer.addHeaderAlias("userId", "用户Id").setColumnWidth(2,16);
        writer.addHeaderAlias("userName", "用户账号").setColumnWidth(3,26);
        writer.addHeaderAlias("commissionNum", "分佣金额").setColumnWidth(4,16);
        //一次性写出内容,强制输出标题
        writer.write(rows, true);
        writer.flush();
        writer.close();
Spread the knowledge