/** * Get the index of the number format (numFmt) record used by this cell format. * * @return the index of the number format */ public static long getNumberFormatIndex(Cell _cell) { Styles stylesPart = _cell.getWorksheetPart().getWorkbookPart().getStylesPart(); CTXf xf = stylesPart.getXfByIndex(_cell.getS()); if (xf == null) { throw new RuntimeException("xf unexpectedly null"); } log.debug("Using NumFmtId " + xf.getNumFmtId()); return xf.getNumFmtId(); //(short)_cellXf.getNumFmtId(); }
/** * Return the cell's style. * * @return the cell's style.</code> */ public static CTCellStyle getCellStyle(Cell _cell) { Styles stylesPart = _cell.getWorksheetPart().getWorkbookPart().getStylesPart(); CTXf xf = stylesPart.getXfByIndex(_cell.getS()); if (xf == null) { throw new RuntimeException("xf unexpectedly null"); } return stylesPart.getStyleByIndex(xf.getXfId()); }
private String getCellStringValue(Cell c) { List<CTRst> stringItems = c.getWorksheetPart().getWorkbookPart().getSharedStrings().getJaxbElement().getSi();
/** * 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 static Date getDateCellValue(Cell _cell) { boolean date1904 = _cell.getWorksheetPart().getWorkbookPart().isDate1904(); int cellType = getCellType(_cell); if (cellType == CELL_TYPE_BLANK) { return null; } double value = getNumericCellValue(_cell); //boolean date1904 = getSheet().getWorkbook().isDate1904(); return DateUtil.getJavaDate(value, date1904); }
/** * Get the index of the number format (numFmt) record used by this cell format. * * @return the index of the number format */ public static long getNumberFormatIndex(Cell _cell) { Styles stylesPart = _cell.getWorksheetPart().getWorkbookPart().getStylesPart(); CTXf xf = stylesPart.getXfByIndex(_cell.getS()); if (xf == null) { throw new RuntimeException("xf unexpectedly null"); } log.debug("Using NumFmtId " + xf.getNumFmtId()); return xf.getNumFmtId(); //(short)_cellXf.getNumFmtId(); }
/** * Return the cell's style. * * @return the cell's style.</code> */ public static CTCellStyle getCellStyle(Cell _cell) { Styles stylesPart = _cell.getWorksheetPart().getWorkbookPart().getStylesPart(); CTXf xf = stylesPart.getXfByIndex(_cell.getS()); if (xf == null) { throw new RuntimeException("xf unexpectedly null"); } return stylesPart.getStyleByIndex(xf.getXfId()); }
private String getCellStringValue(Cell c) { List<CTRst> stringItems = c.getWorksheetPart().getWorkbookPart().getSharedStrings().getJaxbElement().getSi();
/** * 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 static Date getDateCellValue(Cell _cell) { boolean date1904 = _cell.getWorksheetPart().getWorkbookPart().isDate1904(); int cellType = getCellType(_cell); if (cellType == CELL_TYPE_BLANK) { return null; } double value = getNumericCellValue(_cell); //boolean date1904 = getSheet().getWorkbook().isDate1904(); return DateUtil.getJavaDate(value, date1904); }