<!-- Don't forget to update status.xml too! -->
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45414 - Don't add too many UncalcedRecords to sheets with charts in them</action>
<action dev="POI-DEVELOPERS" type="fix">45398 - Support detecting date formats containing "am/pm" as date times</action>
<action dev="POI-DEVELOPERS" type="fix">45410 - Removed dependency from contrib on commons beanutils,collections and lang</action>
<action dev="POI-DEVELOPERS" type="add">New helper, HSSFOptimiser, which handles removing duplicated font and style records, to avoid going over the limits in Excel</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="fix">45414 - Don't add too many UncalcedRecords to sheets with charts in them</action>
<action dev="POI-DEVELOPERS" type="fix">45398 - Support detecting date formats containing "am/pm" as date times</action>
<action dev="POI-DEVELOPERS" type="fix">45410 - Removed dependency from contrib on commons beanutils,collections and lang</action>
<action dev="POI-DEVELOPERS" type="add">New helper, HSSFOptimiser, which handles removing duplicated font and style records, to avoid going over the limits in Excel</action>
// If the BOF record was just serialized then add the IndexRecord
if (record.getSid() == BOFRecord.sid) {
- // Add an optional UncalcedRecord
- if (_isUncalced) {
- UncalcedRecord rec = new UncalcedRecord();
- pos += rec.serialize(pos, data);
- }
- //Can there be more than one BOF for a sheet? If not then we can
- //remove this guard. So be safe it is left here.
- if (rows != null && !haveSerializedIndex) {
+ if (!haveSerializedIndex) {
haveSerializedIndex = true;
- pos += serializeIndexRecord(k, pos, data);
+ // Add an optional UncalcedRecord. However, we should add
+ // it in only the once, after the sheet's own BOFRecord.
+ // If there are diagrams, they have their own BOFRecords,
+ // and one shouldn't go in after that!
+ if (_isUncalced) {
+ UncalcedRecord rec = new UncalcedRecord();
+ pos += rec.serialize(pos, data);
+ }
+ //Can there be more than one BOF for a sheet? If not then we can
+ //remove this guard. So be safe it is left here.
+ if (rows != null) {
+ pos += serializeIndexRecord(k, pos, data);
+ }
}
}
}
HSSFSheet sh = wb.getSheetAt(0);
for(short i=0; i < 30; i++) sh.autoSizeColumn(i);
}
+
+ /**
+ * We used to add too many UncalcRecords to sheets
+ * with diagrams on. Don't any more
+ */
+ public void test45414() throws Exception {
+ HSSFWorkbook wb = openSample("WithThreeCharts.xls");
+ wb.getSheetAt(0).setForceFormulaRecalculation(true);
+ wb.getSheetAt(1).setForceFormulaRecalculation(false);
+ wb.getSheetAt(2).setForceFormulaRecalculation(true);
+
+ // Write out and back in again
+ // This used to break
+ HSSFWorkbook nwb = writeOutAndReadBack(wb);
+
+ // Check now set as it should be
+ assertTrue(nwb.getSheetAt(0).getForceFormulaRecalculation());
+ assertFalse(nwb.getSheetAt(1).getForceFormulaRecalculation());
+ assertTrue(nwb.getSheetAt(2).getForceFormulaRecalculation());
+ }
}