Esempio n. 1
0
 /**
  * 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.
  *
  * @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) {
   // TODO: activate this when compiling against 3.7.
   // boolean date1904 = getSheet().getXSSFWorkbook().isDate1904();
   boolean date1904 = false;
   setCellValue(DateUtil.getExcelDate(value, date1904));
 }
Esempio n. 2
0
 /**
  * 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.
  *
  * @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));
 }