Search in sources :

Example 1 with CTXf

use of org.xlsx4j.sml.CTXf in project docx4j by plutext.

the class CellUtils method getNumberFormatIndex.

// /**
// * Get the index of the number format (numFmt) record used by this cell format.
// *
// * @return the index of the number format
// */
// public long getDataFormatIndexZZZ(CTCellStyle cellStyle) {
// CTXf xf = this.stylesPart.getXfByIndex(cellStyle.getXfId());
// if (xf == null) {
// throw new RuntimeException("xf unexpectedly null");
// }
// 
// System.out.println("Using NumFmtId " + xf.getNumFmtId());
// 
// return xf.getNumFmtId();
// //(short)_cellXf.getNumFmtId();
// }
/**
 * 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 = WorksheetPart.getWorksheetPart(_cell).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();
}
Also used : CTXf(org.xlsx4j.sml.CTXf) Styles(org.docx4j.openpackaging.parts.SpreadsheetML.Styles)

Example 2 with CTXf

use of org.xlsx4j.sml.CTXf in project docx4j by plutext.

the class CellUtils method getCellStyle.

/**
 * Return the cell's style.
 *
 * @return the cell's style.</code>
 */
public static CTCellStyle getCellStyle(Cell _cell) {
    Styles stylesPart = WorksheetPart.getWorksheetPart(_cell).getWorkbookPart().getStylesPart();
    CTXf xf = stylesPart.getXfByIndex(_cell.getS());
    if (xf == null) {
        throw new RuntimeException("xf unexpectedly null");
    }
    return stylesPart.getStyleByIndex(xf.getXfId());
}
Also used : CTXf(org.xlsx4j.sml.CTXf) Styles(org.docx4j.openpackaging.parts.SpreadsheetML.Styles)

Aggregations

Styles (org.docx4j.openpackaging.parts.SpreadsheetML.Styles)2 CTXf (org.xlsx4j.sml.CTXf)2