利用XLSTransformer生成excel

XLSTransformer transformer = new XLSTransformer();
        String distFile = System.getProperty("java.io.tmpdir") + "/" + fileName + ".xls";
        File template = ResourceUtils.getFile("classpath:template/excel/" + name + ".xls");
        transformer.transformXLS(template.getPath(), beans, distFile);
        response.setContentType("application/xls");
        response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + ".xls\"");
        StreamUtils.copy(new FileInputStream(new File(distFile)), response.getOutputStream());

你可能感兴趣的:(transform)