java - 如何使用 java POI 从日期单元格中获取原始文本
问题描述
细胞参考细胞参考 = 新细胞参考(当前);// 传递包含公式的单元格
CellValue cellValue = evaluator.evaluate(current);
System.out.println("Cell value : "+cellValue.getNumberValue()); // 44319.0
cellValue.getStringValue(); // Null
DataFormatter formatter = new DataFormatter();
String strValue = formatter.formatCellValue(current);
System.out.println("strValue :- "+strValue); // 5/3/21
String data0 = String.valueOf(current.getNumericCellValue());
System.out.println("data0 :- "+data0); //44319.0
String value = formatter.formatCellValue(current, evaluator);
System.out.println("value :- "+value); //5/3/21
System.out.println("Date value :- "+current.getDateCellValue()); // Mon May 03 00:00:00 IST 2021
但我需要将 RAW 值作为 03/05/2021 作为文本。
解决方案
推荐阅读
- node.js - 页面刷新后如何保持用户登录
- java - 如何在xml中拉伸宽度布局以填充屏幕
- sql - 复制存在日期间隔的最近日期的行值
- sql - SQL中如何将表和数组相交
- c# - 有没有办法在 c# 中延迟 if 语句/方法
- bash - 无法在终端命令行上将数据文件编入脚本文件 (bash)
- flutter - NoSuchMethodError : 在 null 上调用了方法“map”
- c++ - 在可变参数模板类中初始化数组
- javascript - 为什么我的 Manifest.json 显示“页面无法脱机工作”
- python - 如何通过 dir() 之类的东西知道内置函数采用什么类型的参数?