zoukankan      html  css  js  c++  java
  • POI依据类型设置导出格式

     //设置Bigdecimal数据导出时以数值形式输出
     CellStyle decimalStyle = workbook.createCellStyle();
     DataFormat decimalDf = workbook.createDataFormat();
     decimalStyle.setDataFormat(decimalDf.getFormat("0.00"));
     decimalStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
     decimalStyle.setAlignment(CellStyle.ALIGN_LEFT);
     //设置Date数据导出时以日期形式输出
     CellStyle dateStyle = workbook.createCellStyle();
     DataFormat dateDf = workbook.createDataFormat();
     dateStyle.setDataFormat(dateDf.getFormat("yyyy/MM/dd"));
     dateStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
     dateStyle.setAlignment(CellStyle.ALIGN_LEFT);
     //设置字符串导出时以文本形式输出
     CellStyle textStyle = workbook.createCellStyle();
     DataFormat textDf = workbook.createDataFormat();
     textStyle.setDataFormat(textDf.getFormat("@"));
     textStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
     textStyle.setAlignment(CellStyle.ALIGN_LEFT);
  • 相关阅读:
    08-jQuery的位置信息
    06-jQuery的文档操作(重点)
    05-使用jQuery操作input的value值
    17-案例
    04-jQuery的属性操作
    03-jQuery动画效果
    02-jQuery的选择器
    01-jQuery的介绍
    16-client、offset、scroll系列
    15-BOM
  • 原文地址:https://www.cnblogs.com/alice-cj/p/10374857.html
Copyright © 2011-2022 走看看