반응형

Apache POI

 * 개요 : 실무에서 엑셀저장 기능을 사용하는 경우 금액이 입력되어야 하는 경우가 있다. 이 때에 가독성이 좋도록 천의 자리 마다 콤바를 추가하는데 아래 방법을 참고한다.

 

* 방법

CellStyle cs = workbook.createCellStyle();
DataFormat df = workbook.createDataFormat();
cs.setDataFormat(df.getFormat("#,##0"));
...
row.getCell(0).setCellStyle(cs);   // 본인의 환경에 맞춰서 스타일을 적용한다

 

 * 도움을 받은 곳

java - Apache POI changing cell format from dot to comma - Stack Overflow

 

Apache POI changing cell format from dot to comma

I'm using Apache POI to generate excel files. I'm trying to format my cells to display no decimal cases and use dot as the thousand separator. (187103,915 -> 187.103). If I apply the format #.##0

stackoverflow.com

 

반응형

+ Recent posts