//设置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);