java中poi读取excel公式、函数计算值,返回无精度缺失的计算值

您所在的位置:网站首页 poi写入excel函数 java中poi读取excel公式、函数计算值,返回无精度缺失的计算值

java中poi读取excel公式、函数计算值,返回无精度缺失的计算值

2023-11-11 16:44| 来源: 网络整理| 查看: 265

java中poi读取excel公式、函数计算值,返回无精度缺失的计算值

香蕉你个不呐呐ture: 大佬厉害,大佬救了我狗命,谢谢 [code=java] case Cell.CELL_TYPE_FORMULA: {// 公式 try { //判断cell是否为特殊日期格式,如果是得拦截-转换,否则会报错 xx-xx月-xxxx(类似于格式 : 01-一月-2022) Pattern r = Pattern.compile("[\\d]{2}(-)([一二三四五六七八九十]{1,2}[月])(-)[\\d]{4}"); Matcher m = r.matcher(cell.toString()); if (m.find()) { // System.out.println("奇怪格式时间分支"); cellValue = new SimpleDateFormat("yyyy/MM/dd").format(cell.getDateCellValue()); break; } //判断公式的类型,时间/数值/字符(报错时为字符) if (DateUtil.isCellDateFormatted(cell)) { // System.out.println("时间分支 -- now()"); cellValue = new SimpleDateFormat("yyyy/MM/dd").format(cell.getDateCellValue()); } else { // Syste [/code]



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3