diff --git a/src/java/org/apache/poi/hssf/model/InternalSheet.java b/src/java/org/apache/poi/hssf/model/InternalSheet.java index cbb921b2f7..8cb482a574 100644 --- a/src/java/org/apache/poi/hssf/model/InternalSheet.java +++ b/src/java/org/apache/poi/hssf/model/InternalSheet.java @@ -22,6 +22,7 @@ import java.util.Iterator; import java.util.List; import org.apache.poi.hssf.record.BOFRecord; +import org.apache.poi.hssf.record.CFHeader12Record; import org.apache.poi.hssf.record.CFHeaderRecord; import org.apache.poi.hssf.record.CalcCountRecord; import org.apache.poi.hssf.record.CalcModeRecord; @@ -190,7 +191,7 @@ public final class InternalSheet { while (rs.hasNext()) { int recSid = rs.peekNextSid(); - if ( recSid == CFHeaderRecord.sid ) { + if ( recSid == CFHeaderRecord.sid || recSid == CFHeader12Record.sid ) { condFormatting = new ConditionalFormattingTable(rs); records.add(condFormatting); continue; diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderBase.java b/src/java/org/apache/poi/hssf/record/CFHeaderBase.java index aa9f2daf03..dc7052de45 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeaderBase.java +++ b/src/java/org/apache/poi/hssf/record/CFHeaderBase.java @@ -62,13 +62,17 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable { public boolean getNeedRecalculation() { // Held on the 1st bit - return field_2_need_recalculation_and_id % 2 == 1; + return (field_2_need_recalculation_and_id & 1) == 1; } public void setNeedRecalculation(boolean b) { // held on the first bit - if (b == getNeedRecalculation()) return; - if (b) field_2_need_recalculation_and_id++; - else field_2_need_recalculation_and_id--; + if (b == getNeedRecalculation()) { + return; + } else if (b) { + field_2_need_recalculation_and_id++; + } else { + field_2_need_recalculation_and_id--; + } } public int getID() { @@ -79,7 +83,9 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable { // Remaining 15 bits of field 2 boolean needsRecalc = getNeedRecalculation(); field_2_need_recalculation_and_id = (id<<1); - if (needsRecalc) field_2_need_recalculation_and_id++; + if (needsRecalc) { + field_2_need_recalculation_and_id++; + } } public CellRangeAddress getEnclosingCellRange() { diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java b/src/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java index 7806fb5184..e6c8c1bf5e 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFExtendedColor.java @@ -97,6 +97,7 @@ public class HSSFExtendedColor extends ExtendedColor { rgb[3] = a; color.setRGBA(rgb); } + color.setType(TYPE_RGB); } public double getTint() {