protected boolean isDate1904() { return _wb.isDate1904(); }
/** * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as * a date. * * @param value the date value to set this cell to. For formulas we'll set the * precalculated value, for numerics we'll set its value. For other types we * will change the cell to a numeric cell and set its value. */ @Override public void setCellValue(Date value) { if(value == null) { setCellType(CellType.BLANK); return; } boolean date1904 = getSheet().getWorkbook().isDate1904(); setCellValue(DateUtil.getExcelDate(value, date1904)); }
/** * Get the value of the cell as a date. * <p> * For strings we throw an exception. For blank cells we return a null. * </p> * @return the value of the cell as a date * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} * @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. * @see DataFormatter for formatting this date into a string similar to how excel does. */ @Override public Date getDateCellValue() { if (getCellType() == CellType.BLANK) { return null; } double value = getNumericCellValue(); boolean date1904 = getSheet().getWorkbook().isDate1904(); return DateUtil.getJavaDate(value, date1904); }
/** * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as * a date. * <p> * This will set the cell value based on the Calendar's timezone. As Excel * does not support timezones this means that both 20:00+03:00 and * 20:00-03:00 will be reported as the same value (20:00) even that there * are 6 hours difference between the two times. This difference can be * preserved by using <code>setCellValue(value.getTime())</code> which will * automatically shift the times to the default timezone. * </p> * * @param value the date value to set this cell to. For formulas we'll set the * precalculated value, for numerics we'll set its value. For othertypes we * will change the cell to a numeric cell and set its value. */ @Override public void setCellValue(Calendar value) { if(value == null) { setCellType(CellType.BLANK); return; } boolean date1904 = getSheet().getWorkbook().isDate1904(); setCellValue( DateUtil.getExcelDate(value, date1904 )); }
protected boolean isDate1904() { return _wb.isDate1904(); }
@Override public boolean isUse1904Windowing() throws ExcelParseException { try { initializeWorkbook(); if (workbook instanceof XSSFWorkbook) { return ((XSSFWorkbook) workbook).isDate1904(); } else if (workbook instanceof HSSFWorkbook) { return ((HSSFWorkbook) workbook).getInternalWorkbook().isUsing1904DateWindowing(); } throw new UnsupportedOperationException("Unsupported workbook type"); } catch (IOException e) { throw new ExcelParseException(e); } }
/** * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as * a date. * * @param value the date value to set this cell to. For formulas we'll set the * precalculated value, for numerics we'll set its value. For other types we * will change the cell to a numeric cell and set its value. */ public void setCellValue(Date value) { boolean date1904 = getSheet().getWorkbook().isDate1904(); setCellValue(DateUtil.getExcelDate(value, date1904)); }
/** * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as * a date. * <p> * This will set the cell value based on the Calendar's timezone. As Excel * does not support timezones this means that both 20:00+03:00 and * 20:00-03:00 will be reported as the same value (20:00) even that there * are 6 hours difference between the two times. This difference can be * preserved by using <code>setCellValue(value.getTime())</code> which will * automatically shift the times to the default timezone. * </p> * * @param value the date value to set this cell to. For formulas we'll set the * precalculated value, for numerics we'll set its value. For othertypes we * will change the cell to a numeric cell and set its value. */ public void setCellValue(Calendar value) { boolean date1904 = getSheet().getWorkbook().isDate1904(); setCellValue( DateUtil.getExcelDate(value, date1904 )); }
/** * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as * a date. * * @param value the date value to set this cell to. For formulas we'll set the * precalculated value, for numerics we'll set its value. For other types we * will change the cell to a numeric cell and set its value. */ @Override public void setCellValue(Date value) { if(value == null) { setCellType(CellType.BLANK); return; } boolean date1904 = getSheet().getWorkbook().isDate1904(); setCellValue(DateUtil.getExcelDate(value, date1904)); }
/** * Get the value of the cell as a date. * <p> * For strings we throw an exception. For blank cells we return a null. * </p> * @return the value of the cell as a date * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is {@link CellType#STRING} * @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. * @see DataFormatter for formatting this date into a string similar to how excel does. */ @Override public Date getDateCellValue() { if (getCellType() == CellType.BLANK) { return null; } double value = getNumericCellValue(); boolean date1904 = getSheet().getWorkbook().isDate1904(); return DateUtil.getJavaDate(value, date1904); }
/** * Get the value of the cell as a date. * <p> * For strings we throw an exception. For blank cells we return a null. * </p> * @return the value of the cell as a date * @throws IllegalStateException if the cell type returned by {@link #getCellType()} is CELL_TYPE_STRING * @exception NumberFormatException if the cell value isn't a parsable <code>double</code>. * @see DataFormatter for formatting this date into a string similar to how excel does. */ public Date getDateCellValue() { int cellType = getCellType(); if (cellType == CELL_TYPE_BLANK) { return null; } double value = getNumericCellValue(); boolean date1904 = getSheet().getWorkbook().isDate1904(); return DateUtil.getJavaDate(value, date1904); }
/** * Set a date value for the cell. Excel treats dates as numeric so you will need to format the cell as * a date. * <p> * This will set the cell value based on the Calendar's timezone. As Excel * does not support timezones this means that both 20:00+03:00 and * 20:00-03:00 will be reported as the same value (20:00) even that there * are 6 hours difference between the two times. This difference can be * preserved by using <code>setCellValue(value.getTime())</code> which will * automatically shift the times to the default timezone. * </p> * * @param value the date value to set this cell to. For formulas we'll set the * precalculated value, for numerics we'll set its value. For othertypes we * will change the cell to a numeric cell and set its value. */ @Override public void setCellValue(Calendar value) { if(value == null) { setCellType(CellType.BLANK); return; } boolean date1904 = getSheet().getWorkbook().isDate1904(); setCellValue( DateUtil.getExcelDate(value, date1904 )); }