Using Apache POI HSSFListener how to identify date type

我的梦境 提交于 2020-08-10 19:54:48

问题


Due to millions of records to handle, I have to handle SAX parsing using the technique given here. http://poi.apache.org/spreadsheet/how-to.html#event_api. However Date type is convered to Number. How to distinguish between Date and Number when using HSSFListener?


回答1:


The Excel file formats store all dates as numbers with special formatting rules. It's not that HSSF is converting it, you're getting exactly what Excel stores in the file!

If you want good examples of HSSF Event processing for .xls files, I would suggest you take a look at XLS2CSVmra from Apache POI and ExcelExtractor from Apache Tika

Both show a number of common things you'll want to do, including detecting Date cells and formatting them appropriately for display



来源:https://stackoverflow.com/questions/14835339/using-apache-poi-hssflistener-how-to-identify-date-type

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!