The date format created by POI can't be recognized by the system. My codes are listed below:
CellStyle cellStyle = wb.createCellStyle();
CreationHelper createHelper = wb.getCreationHelper();
short dateFormat = createHelper.createDataFormat().getFormat("MM/dd/yyyy");
cellStyle.setDataFormat(dateFormat);
cell.setCellStyle(cellStyle);
cell.setCellValue(new Date());
However, if I open the excel my java code created, I would see that the cell is in Custom format with "mm/dd/yyyy" type. And the cell is aligned to the left of the cell and our client's system can't read the data in the cell and update this data to their system.
However, if I double click on the cell and don't make any changes, but press "Enter" after that, the cell is still in Custom format with "mm/dd/yyyy" type, but it is aligned to the right of the cell now. And at this time, my client's system can read the data in the cell and upload the data to the system.
It seems like that the cell style my java code generated is different from the one excel generated. Can anyone help me with this?