diff --git a/src/java/org/apache/poi/hssf/record/CFRule12Record.java b/src/java/org/apache/poi/hssf/record/CFRule12Record.java index e7974a092..80a31b321 100644 --- a/src/java/org/apache/poi/hssf/record/CFRule12Record.java +++ b/src/java/org/apache/poi/hssf/record/CFRule12Record.java @@ -21,6 +21,7 @@ import java.util.Arrays; import org.apache.poi.hssf.record.cf.ColorGradientFormatting; import org.apache.poi.hssf.record.cf.IconMultiStateFormatting; +import org.apache.poi.hssf.record.cf.IconMultiStateThreshold; import org.apache.poi.hssf.record.cf.Threshold; import org.apache.poi.hssf.record.common.FtrHeader; import org.apache.poi.hssf.record.common.FutureRecord; @@ -125,7 +126,7 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord { public static CFRule12Record create(HSSFSheet sheet, IconSet iconSet) { Threshold[] ts = new Threshold[iconSet.num]; for (int i=0; i 0) { @@ -63,9 +53,6 @@ public final class Threshold { type != RangeType.MAX.id) { value = in.readDouble(); } - equals = in.readByte(); - // Reserved, 4 bytes, all 0 - in.readInt(); } public byte getType() { @@ -74,7 +61,7 @@ public final class Threshold { public void setType(byte type) { this.type = type; - // Ensure the value presense / absense is consistent for the new type + // Ensure the value presence / absence is consistent for the new type if (type == RangeType.MIN.id || type == RangeType.MAX.id || type == RangeType.FORMULA.id) { this.value = null; @@ -106,19 +93,11 @@ public final class Threshold { this.value = value; } - public byte getEquals() { - return equals; - } - public void setEquals(byte equals) { - this.equals = equals; - } - public int getDataLength() { int len = 1 + formula.getEncodedSize(); if (value != null) { len += 8; } - len += 5; return len; } @@ -132,13 +111,10 @@ public final class Threshold { return buffer.toString(); } - public Object clone() { - Threshold rec = new Threshold(); + public void copyTo(Threshold rec) { rec.type = type; rec.formula = formula; rec.value = value; - rec.equals = equals; - return rec; } public void serialize(LittleEndianOutput out) { @@ -151,7 +127,5 @@ public final class Threshold { if (value != null) { out.writeDouble(value); } - out.writeByte(equals); - out.writeInt(0); // Reserved } } diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFColorScaleFormatting.java b/src/java/org/apache/poi/hssf/usermodel/HSSFColorScaleFormatting.java index 6e82072d4..3d4613f98 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFColorScaleFormatting.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFColorScaleFormatting.java @@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel; import org.apache.poi.hssf.record.CFRule12Record; import org.apache.poi.hssf.record.cf.ColorGradientFormatting; +import org.apache.poi.hssf.record.cf.ColorGradientThreshold; import org.apache.poi.hssf.record.cf.Threshold; import org.apache.poi.ss.usermodel.Color; import org.apache.poi.ss.usermodel.ConditionalFormattingThreshold; @@ -62,14 +63,15 @@ public final class HSSFColorScaleFormatting implements org.apache.poi.ss.usermod } public void setThresholds(ConditionalFormattingThreshold[] thresholds) { - Threshold[] t = new Threshold[thresholds.length]; + ColorGradientThreshold[] t = new ColorGradientThreshold[thresholds.length]; for (int i=0; i