반응형
* 개요 : 실무에서 엑셀저장 기능을 사용하는 경우 금액이 입력되어야 하는 경우가 있다. 이 때에 가독성이 좋도록 천의 자리 마다 콤바를 추가하는데 아래 방법을 참고한다.
* 방법
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
반응형
'Java' 카테고리의 다른 글
Apache POI 엑셀 저장 시 높이를 자동으로 설정하기 (0) | 2023.02.01 |
---|---|
Apache Poi 병합셀 테두리 문제 해결 (2) | 2020.08.06 |
List<Map<String, String>> 중복제거 참고 (0) | 2020.06.24 |
큰 금액 double 형식을 문자열로 나타낼 때 (0) | 2020.02.21 |
서버에 있는 PDF 파일을 웹페이지에서 보여주는 방법 (1) | 2019.10.17 |