Richard Glen
04/18/2024, 5:04 PMNikita Klimenko [JB]
04/18/2024, 5:06 PMRichard Glen
04/18/2024, 5:08 PMNikita Klimenko [JB]
04/18/2024, 5:15 PMreadExcel
converts values that apache poi sees as numeric to LocalDateTime
CellType.NUMERIC -> {
val number = numericCellValue
when {
DateUtil.isCellDateFormatted(this) -> DateUtil.getLocalDateTime(number).toKotlinLocalDateTime()
else -> number
}
}
There's no direct way to get cell value as String now. I assumed this is a lossless conversion and `KotlinLocalDateTime`can be converted back to any value that you need. Maybe i overlooked something
DateUtil.getLocalDateTime(number).toKotlinLocalDateTime()
Nikita Klimenko [JB]
04/18/2024, 5:20 PM/**
* Get the value of the cell as a string
* <p>
* For numeric cells we throw an exception. For blank cells we return an empty string.
* For formulaCells that are not string Formulas, we throw an exception.
* </p>
* @return the value of the cell as a string
*/
String getStringCellValue();
Richard Glen
04/18/2024, 5:24 PMNikita Klimenko [JB]
04/18/2024, 5:30 PMreadExcel
val style: CellStyle = cell.getCellStyle()
val dataFormatter = DataFormatter()
val formattedCellValue = dataFormatter.formatCellValue(cell, style)
Returns the formatted value of a cell as a String regardless of the cell type.
formatCellValue
But unfortunately i don't see a workaround that you can use until this is implemented on the library sideNikita Klimenko [JB]
04/18/2024, 5:35 PM