I am trying to print out a cell from an encrypted Excel workbook. The cell contains a time and when i try to print cell.getNumericCellValue()
, the result is a random number, that seems to be dependend of the time within the cell, in this case 0.5208333333333334
. When I try to just print the cell, the result is always this date: 31-Dez.-1899
, independend of the time within the cell. Here is the cell within the Excel sheet: Screenshot
I am using Windows 11, Eclipse Version: 2021-12 (4.22.0), JDK Version: jdk-17.0.2
This is the code executed:
XSSFWorkbook wb = null;
try (FileInputStream fis = new FileInputStream(excelFilePath);){
wb = ((XSSFWorkbook)WorkbookFactory.create(fis, password));
} catch (IOException | EncryptedDocumentException e) {
e.printStackTrace();
}
XSSFSheet sheet = wb.getSheetAt(0);
XSSFCell cell = sheet.getRow(1).getCell(1);
System.out.println(cell); // results in 31-Dez.-1899
System.out.println(cell.getNumericCellValue()); // results in 0.5208333333333334