Example usage for org.apache.poi.hssf.usermodel HSSFCellStyle getParentStyle

List of usage examples for org.apache.poi.hssf.usermodel HSSFCellStyle getParentStyle

Introduction

In this page you can find the example usage for org.apache.poi.hssf.usermodel HSSFCellStyle getParentStyle.

Prototype

public HSSFCellStyle getParentStyle() 

Source Link

Document

Return the parent style for this cell style.

Usage

From source file:org.formulacompiler.spreadsheet.internal.excel.xls.saver.ExcelXLSSaver.java

License:Open Source License

private void extractCellFormatsFrom(Workbook _xwb) {
    final short styleCount = _xwb.getNumCellStyles();
    for (short idx = 0; idx < styleCount; idx++) {
        final HSSFCellStyle cellStyle = (HSSFCellStyle) _xwb.getCellStyleAt(idx);
        try {//w  ww .  jav  a2  s.  c om
            final String styleName = cellStyle.getParentStyle().getUserStyleName();
            if (styleName != null) {
                this.cellStyles.put(styleName, cellStyle);
            }
        } catch (Exception e) {
            // Do nothing, we use only styles with parents
        }
    }
}