diff --git a/src/java/org/apache/poi/hssf/dev/BiffViewer.java b/src/java/org/apache/poi/hssf/dev/BiffViewer.java index 58753048c..3afd25a4a 100644 --- a/src/java/org/apache/poi/hssf/dev/BiffViewer.java +++ b/src/java/org/apache/poi/hssf/dev/BiffViewer.java @@ -179,6 +179,8 @@ public final class BiffViewer { case CFHeaderRecord.sid: return new CFHeaderRecord(in); case CFHeader12Record.sid: return new CFHeader12Record(in); case CFRuleRecord.sid: return new CFRuleRecord(in); + case CFRule12Record.sid: return new CFRule12Record(in); + // TODO Add CF Ex, and remove from UnknownRecord case CalcCountRecord.sid: return new CalcCountRecord(in); case CalcModeRecord.sid: return new CalcModeRecord(in); case CategorySeriesAxisRecord.sid:return new CategorySeriesAxisRecord(in); diff --git a/src/java/org/apache/poi/hssf/record/CFRuleBase.java b/src/java/org/apache/poi/hssf/record/CFRuleBase.java index b7db3a7a0..449594414 100644 --- a/src/java/org/apache/poi/hssf/record/CFRuleBase.java +++ b/src/java/org/apache/poi/hssf/record/CFRuleBase.java @@ -347,7 +347,7 @@ public abstract class CFRuleBase extends StandardRecord { } protected int getFormattingBlockSize() { - return + return 6 + (containsFontFormattingBlock()?_fontFormatting.getRawRecord().length:0)+ (containsBorderFormattingBlock()?8:0)+ (containsPatternFormattingBlock()?4:0); diff --git a/src/java/org/apache/poi/hssf/record/CFRuleRecord.java b/src/java/org/apache/poi/hssf/record/CFRuleRecord.java index a00fde731..52678c0fd 100644 --- a/src/java/org/apache/poi/hssf/record/CFRuleRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFRuleRecord.java @@ -114,7 +114,7 @@ public final class CFRuleRecord extends CFRuleBase { } protected int getDataSize() { - return 12 + getFormattingBlockSize() + + return 6 + getFormattingBlockSize() + getFormulaSize(getFormula1())+ getFormulaSize(getFormula2()); } diff --git a/src/java/org/apache/poi/hssf/record/RecordFactory.java b/src/java/org/apache/poi/hssf/record/RecordFactory.java index 6163fc000..c1a0f5707 100644 --- a/src/java/org/apache/poi/hssf/record/RecordFactory.java +++ b/src/java/org/apache/poi/hssf/record/RecordFactory.java @@ -151,6 +151,7 @@ public final class RecordFactory { CFHeaderRecord.class, CFHeader12Record.class, CFRuleRecord.class, + CFRule12Record.class, ChartRecord.class, ChartTitleFormatRecord.class, CodepageRecord.class, diff --git a/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java b/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java index e562f52f4..3be13558b 100644 --- a/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java +++ b/src/testcases/org/apache/poi/hssf/record/TestCFRuleRecord.java @@ -402,8 +402,7 @@ public final class TestCFRuleRecord extends TestCase { assertArrayEquals(serializedRecord, serializedClone); } - // TODO Fix this test! - public void IGNORED_testBug57231_rewrite() { + public void testBug57231_rewrite() { HSSFWorkbook wb = HSSFITestDataProvider.instance.openSampleWorkbook("57231_MixedGasReport.xls"); assertEquals(7, wb.getNumberOfSheets()); wb = HSSFITestDataProvider.instance.writeOutAndReadBack(wb);