ublic WritableCellFormat style_date = new WritableCellFormat(new DateFormat("yyyy/MM/dd") );
-----------------------------------------
style_date.setAlignment(Alignment.CENTRE);
style_date.setFont( new WritableFont(WritableFont.COURIER, 9) );
style_date.setBorder(Border.ALL, BorderLineStyle.THIN);
-----------------------------------------
data = U.formatDate(U.nullToString((String)PropertyUtils.getProperty(data_list.get(i), column.data_name)).toString());
dateval = new SimpleDateFormat("yyyy/MM/dd").parse(data);//日期已经格式化好了
-----------------------------------------
labelDt = new DateTime(col, row, dateval, style_date );
label.setCellFormat(style_date );
sheet.addCell(labelDt);
-----------------------------------------
电脑上设置的日期格式是yyyy-MM-dd;
代码里设置的日期格式是yyyy/MM/dd;
导出EXCEL显示的是yyyy-MM-dd,而不是代码里设置的yyyy/MM/dd;
不修改电脑设置,怎么实现导出EXCEL的日期格式和代码里设置的一样呢?
转载于:https://www.cnblogs.com/ahwankong/p/3198924.html