Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is no direct method in the current source code:</p> <p>This is how the style is created:</p> <pre><code>public HSSFCellStyle createCellStyle() { ... ExtendedFormatRecord xfr = workbook.createCellXF(); short index = (short) (getNumCellStyles() - 1); HSSFCellStyle style = new HSSFCellStyle(index, xfr, this); return style; } </code></pre> <p>with </p> <pre><code>public short getNumCellStyles() { return (short) workbook.getNumExFormats(); } </code></pre> <p>and (in InternalWorkbook)</p> <pre><code>public int getNumExFormats() { ... return numxfs; } </code></pre> <p>and with the workbook.createCellXF() resolving to:</p> <pre><code>public ExtendedFormatRecord createCellXF() { ExtendedFormatRecord xf = createExtendedFormat(); records.add(records.getXfpos()+1, xf); records.setXfpos( records.getXfpos() + 1 ); numxfs++; return xf; } </code></pre> <p>So what is possible from the HSSFWorkbook, is to call:</p> <pre><code>InternalWorkbook getWorkbook() { return workbook; } </code></pre> <p>and then on the InternalWorkbook object:</p> <pre><code>public ExtendedFormatRecord getExFormatAt(int index) { int xfptr = records.getXfpos() - (numxfs - 1); xfptr += index; ExtendedFormatRecord retval = ( ExtendedFormatRecord ) records.get(xfptr); return retval; } public void removeExFormatRecord(ExtendedFormatRecord rec) { records.remove(rec); // this updates XfPos for us numxfs--; } </code></pre> <p>So to make it short, from the top workbook, something like this:</p> <pre><code> InternalWorkbook w = workbook.getWorkbook(); ExtendedFormatRecord record = w.getExFormatAt(index); w.removeExFormatRecord(record); </code></pre> <p>This is all very horrible :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload