采用POI操作excel API:http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFCell.html poi包:http://pan.baidu.com/s/1hmIQU 一.读取excel内容 1.excel内容的值如果不是string,则用getNumericCellValue(),得到double类型,再做相应转换,如果为string,则用getStringCellValue() public static S
最近在做导入的时候发现,excel中设置数值格式是不能有日期的那些符号出现的,/ - : 之类的,否则就会变成数字到了java后台,设置成日期,比如 yyyy-mm-dd 到了后台也是数字,即距离1900年到现在的天数,这个时候校验肯定是很不方便的,所以只能转一下: //创建1900年的日历对象 Calendar c = new GregorianCalendar(1900,0,-1); Date d = c.getTime(); //获取时间戳 ,然后加上天数,因为excel中默认会传来今天到