<!-- Don't forget to update status.xml too! -->
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Expose the name of Named Cell Styles via HSSFCellStyle (normally held on the parent style though)</action>
<action dev="POI-DEVELOPERS" type="fix">45978 - Fixed IOOBE in Ref3DPtg.toFormulaString() due eager initialisation of SheetReferences</action>
<action dev="POI-DEVELOPERS" type="add">Made HSSFFormulaEvaluator no longer require initialisation with sheet or row</action>
<action dev="POI-DEVELOPERS" type="add">Extended support for cached results of formula cells</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">Expose the name of Named Cell Styles via HSSFCellStyle (normally held on the parent style though)</action>
<action dev="POI-DEVELOPERS" type="fix">45978 - Fixed IOOBE in Ref3DPtg.toFormulaString() due eager initialisation of SheetReferences</action>
<action dev="POI-DEVELOPERS" type="add">Made HSSFFormulaEvaluator no longer require initialisation with sheet or row</action>
<action dev="POI-DEVELOPERS" type="add">Extended support for cached results of formula cells</action>
{
return index;
}
+
+ /**
+ * Return the parent style for this cell style.
+ * In most cases this will be null, but in a few
+ * cases there'll be a fully defined parent.
+ */
+ public HSSFCellStyle getParentStyle() {
+ if(format.getParentIndex() == 0) {
+ return null;
+ }
+ return new HSSFCellStyle(
+ format.getParentIndex(),
+ workbook.getExFormatAt(format.getParentIndex()),
+ workbook
+ );
+ }
/**
* set the data format (must be a valid format)
assertEquals(23, cs2.getIndex());
assertEquals(24, cs3.getIndex());
+ assertNull(cs1.getParentStyle());
+ assertNotNull(cs2.getParentStyle());
+ assertNotNull(cs3.getParentStyle());
+
+ assertEquals(21, cs2.getParentStyle().getIndex());
+ assertEquals(22, cs3.getParentStyle().getIndex());
+
+ // Now check we can get style records for
+ // the parent ones
+ assertNull(wb.getWorkbook().getStyleRecord(15));
+ assertNull(wb.getWorkbook().getStyleRecord(23));
+ assertNull(wb.getWorkbook().getStyleRecord(24));
+
+ assertNotNull(wb.getWorkbook().getStyleRecord(21));
+ assertNotNull(wb.getWorkbook().getStyleRecord(22));
+
// Now check the style names
-// assertEquals(null, cs1.getUserStyleName());
-// assertEquals("style1", cs2.getUserStyleName());
-// assertEquals("style2", cs3.getUserStyleName());
+ assertEquals(null, cs1.getUserStyleName());
+ assertEquals(null, cs2.getUserStyleName());
+ assertEquals(null, cs3.getUserStyleName());
+ assertEquals("style1", cs2.getParentStyle().getUserStyleName());
+ assertEquals("style2", cs3.getParentStyle().getUserStyleName());
}
public static void main(String [] ignored_args)