/** * Create an instance of {@link CTXf } * */ public CTXf createCTXf() { return new CTXf(); }
/** * 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(); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
public void saveStyle() { if (!newCellXfs.isEmpty()) { CTCellXfs ctCellXfs = ctStylesheet.getCellXfs(); if (ctCellXfs == null) { ctCellXfs = new CTCellXfs(); ctStylesheet.setCellXfs(ctCellXfs); } ctCellXfs.setCount((long) cellXfsIndex.size()); List<CTXf> xfs = ctCellXfs.getXf(); for (CellXfs cellXfs : newCellXfs) { CTXf ctXf = new CTXf(); ctXf.setNumFmtId(cellXfs.getNumFmtId()); ctXf.setFontId(cellXfs.getFontId()); ctXf.setFillId(cellXfs.getFillId()); ctXf.setBorderId(cellXfs.getBorderId()); ctXf.setXfId(cellXfs.getXfId()); ctXf.setParent(ctCellXfs); xfs.add(ctXf); } } }
protected CTXf generateCTXf(Long borderId, Long XfId, Long numFmtId, Long fontId, Long fillId, CTCellAlignment alignment, Boolean applyBorder) { CTXf xf = new CTXf(); if (applyBorder != null) xf.setApplyBorder(applyBorder); if (borderId != null) xf.setBorderId(borderId); if (XfId != null) xf.setXfId(XfId); if (numFmtId != null) xf.setNumFmtId(numFmtId); if (fontId != null) xf.setFontId(fontId); if (fillId != null) xf.setFillId(fillId); if (alignment != null) xf.setAlignment(alignment); return xf; }
CellStyle cellStyle = new CellStyle(ctCellStyle.getXfId(), ctCellStyle.getName(), xf.getNumFmtId(), xf.getFontId(), xf.getFillId(), xf.getBorderId()); namedStyles.put(cellStyle.getName(), cellStyle); } catch (IndexOutOfBoundsException e) { CellXfs cellXfs = new CellXfs(xf.getXfId(), xf.getNumFmtId(), xf.getFontId(), xf.getFillId(), xf.getBorderId()); cellXfsIndex.add(cellXfs);
/** * 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()); }
public void saveStyle() { if (!newCellXfs.isEmpty()) { CTCellXfs ctCellXfs = ctStylesheet.getCellXfs(); if (ctCellXfs == null) { ctCellXfs = new CTCellXfs(); ctStylesheet.setCellXfs(ctCellXfs); } ctCellXfs.setCount((long) cellXfsIndex.size()); List<CTXf> xfs = ctCellXfs.getXf(); for (CellXfs cellXfs : newCellXfs) { CTXf ctXf = new CTXf(); ctXf.setNumFmtId(cellXfs.getNumFmtId()); ctXf.setFontId(cellXfs.getFontId()); ctXf.setFillId(cellXfs.getFillId()); ctXf.setBorderId(cellXfs.getBorderId()); ctXf.setXfId(cellXfs.getXfId()); ctXf.setParent(ctCellXfs); xfs.add(ctXf); } } }
CellStyle cellStyle = new CellStyle(ctCellStyle.getXfId(), ctCellStyle.getName(), xf.getNumFmtId(), xf.getFontId(), xf.getFillId(), xf.getBorderId()); namedStyles.put(cellStyle.getName(), cellStyle); } catch (IndexOutOfBoundsException e) { CellXfs cellXfs = new CellXfs(xf.getXfId(), xf.getNumFmtId(), xf.getFontId(), xf.getFillId(), xf.getBorderId()); cellXfsIndex.add(cellXfs);
/** * 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()); }
/** * Create an instance of {@link CTXf } * */ public CTXf createCTXf() { return new CTXf(); }
/** * This method is invoked by the JAXB implementation on each instance when unmarshalling completes. * * @param parent * The parent object in the object tree. * @param unmarshaller * The unmarshaller that generated the instance. */ public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { setParent(parent); }
/** * 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(); }