use of org.apache.poi.hssf.record.PaletteRecord in project poi by apache.
the class InternalWorkbook method getCustomPalette.
/**
* Returns the custom palette in use for this workbook; if a custom palette record
* does not exist, then it is created.
*
* @return the custom palette
*/
public PaletteRecord getCustomPalette() {
PaletteRecord palette;
int palettePos = records.getPalettepos();
if (palettePos != -1) {
Record rec = records.get(palettePos);
if (rec instanceof PaletteRecord) {
palette = (PaletteRecord) rec;
} else {
throw new RuntimeException("InternalError: Expected PaletteRecord but got a '" + rec + "'");
}
} else {
palette = createPalette();
//Add the palette record after the bof which is always the first record
records.add(1, palette);
records.setPalettepos(1);
}
return palette;
}
use of org.apache.poi.hssf.record.PaletteRecord in project poi by apache.
the class TestHSSFPalette method setUp.
@Before
public void setUp() {
_palette = new PaletteRecord();
_hssfPalette = new HSSFPalette(_palette);
}
Aggregations