범스의 미투데이 - 2008년 11월 18일



  • 아파치의 POI를 이용하여 Excel 파일 안의 내용을 읽어오려 하는데… 숫자든 날짜든 상관없이 String 형으로 받아 올 수 있는 방법… 있나요?
    (없는듯한데_마지막_희망 가능하면_좋겠는데... 미투지식인)
    2008-11-18 11:36:03




이 글은 범스님의
2008년 11월 18일
미투데이 내용입니다.


by Ambush | 2008/11/19 04:33 | 트랙백 | 덧글(1)
트랙백 주소 : http://bumsgy.egloos.com/tb/4738728
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]
Commented by mipqim at 2009/01/28 17:27
switch로 cell.getCellType() 얻어 온 다음에...
숫자인 경우 아래와 같이 처리 하시면...

case HSSFCell.CELL_TYPE_NUMERIC:
if (HSSFDateUtil.isCellDateFormatted(cell)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
data = formatter.format(cell.getDateCellValue());
} else{
double ddata = cell.getNumericCellValue();
data = String.valueOf(ddata);
}
break;

물론... SimpleDateFormat을 저렇게 쓰면... 시:분:초 가 있는 cell data는 잘리겠죠...
더 연구해서 저도 좀 알려주세요 ㅎㅎ

:         :

:

비공개 덧글



< 이전페이지 다음페이지 >