poi导出excel设置超链接、字体样式、边框等

@RequestMapping(value = "/outURL", method = RequestMethod.GET)
    @ApiOperation(value = "导出超链接")
    public void outURL(HttpServletResponse response) throws IOException {
        //使用模板导出
        Resource resource=new ClassPathResource("file/test.xlsx");
        XSSFWorkbook workbook = new XSSFWorkbook(resource.getInputStream());
        XSSFSheet mainSheet = workbook.getSheetAt(0);

        //统一设置默认列宽,width为字符个数
        mainSheet.setDefaultColumnWidth(20);
        //模板数据行 样式
        Row styleRow = mainSheet.getRow(2);
        CellStyle[] cellStyles=new CellStyle[styleRow.getLastCellNum()];
        for (int c=0;c

导出结果

poi导出excel设置超链接、字体样式、边框等_第1张图片

你可能感兴趣的:(java,poi)