• PoI 3.17 已过时代码对比


    PoI 3.17 已过时代码对比
    颜色定义变化
    旧版本 : HSSFColor.BLACK.index
    新版本 : IndexedColors.BLACK.index

    获取单元格格式
    旧版本 : cell.getCellType 与之应对的单元格格式 HSSFCell.CELL_TYPE_BLANK
    新版本 : cell.getCellTypeEnum 与之对应的单元格格式 BLANK (org.apache.poi.ss.usermodel.CellType.BLANK)

    设置单元格格式
    旧版本 : row.getCell(0).setCellType(Cell.CELL_TYPE_STRING);
    新版本 : row.getCell(0).setCellType(CellType.STRING);

    设置单元格垂直居中样式
    旧版本 : XSSFCellStyle cellStyle = wb.createCellStyle();
        cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER); // 居中
        cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);//垂直
    新版本 : XSSFCellStyle cellStyle = wb.createCellStyle();
        cellStyle.setAlignment(HorizontalAlignment.CENTER); // 居中
        cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //垂直

    设置边框
    旧版本 : cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN); //下边框
    新版本 : cellStyle.setBorderBottom(BorderStyle.THIN); //下边框

    合并单元格
    旧版本 : sheet.addMergedRegion(new CellRangeAddress(1, 1,(short) 0, (short) 0));// 起始行,结束行,起始列,结束列
    新版本 : sheet.addMergedRegion(new Region(1, (short) 0, 1,(short) 0));// 起始行,起始列,结束行,结束列

    设置字体加粗
    旧版本: font.setBoldweight((short) 400);
    新版本: font.setBold(true);

    待更新 . .

  • 相关阅读:
    清理一瓶花茶中的虫子
    一些网上的新信息安全问题
    对于秋季高程备课的随笔
    用共享单车第一次遇到程序出现问题的思考
    开始带学生的一些感受
    对近期北辰开会的一些总结
    WSN和RFID书上好多问题:关于S50
    统计课设成绩用到excel画成绩频率分布曲线
    linux 常用命令
    局域网 ARP 欺骗原理详解
  • 原文地址:https://www.cnblogs.com/qingmuchuanqi48/p/11966472.html
Copyright © 2020-2023  润新知