java - Applying specific cell data format using POI -
i need apply specific data format cell. xssfcellstyle cellstyle = workbook.createcellstyle(); xssfdataformat format = workbook.createdataformat(); cellstyle.setdataformat(format.getformat("m/d/yy h:mm")); datacell.setcelltype(1); //string datacell.setcellstyle(cellstyle); the data being written problem format applied only when open excel sheet (in excel application), click inside cell data. , pressing enter key. format applied. how can apply format without clicking on every cell? your problem you're setting cell string. part, cell formatting rules apply numeric cells. don't apply string cells, don't formatted (as they're formatted string!) xssfcellstyle cellstyle = workbook.createcellstyle(); xssfdataformat format = workbook.createdataformat(); cellstyle.setdataformat(format.getformat("m/d/yy h:mm")); datacell.setcellstyle(cellstyle); // set cell type not needed, setcellvalue datacell.setcelltype(cell.c...