Apache-POI の Excel出力、
日付時刻を任意書式で出力と、セル幅の自動調整
XSSFWorkbook book = new XSSFWorkbook();
XSSFSheet sheet = book.createSheet("シート1");
// 3行目
XSSFRow row = sheet.createRow(2);
// 2列目
XSSFCell cell = row.createCell(1);
// 日付時刻書式を生成
XSSFCreationHelper creationHelper = book.getCreationHelper();
XSSFCellStyle style = book.createCellStyle();
style.setDataFormat(creationHelper.createDataFormat().getFormat("yyyy/MM/dd HH:mm:ss"));
cell.setCellStyle(style);
cell.setCellValue(new Date());
//列幅を自動調節する
sheet.autoSizeColumn(1);