mirror of https://github.com/apache/poi.git
Fixed a problem with save-and-load of conditional formattings (CFHeader12 wasn't added to conditional formattings, rgb value wasn't saved in extended color)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1706739 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
012cfb107c
commit
79879fb286
|
@ -22,6 +22,7 @@ import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.BOFRecord;
|
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.CFHeaderRecord;
|
||||||
import org.apache.poi.hssf.record.CalcCountRecord;
|
import org.apache.poi.hssf.record.CalcCountRecord;
|
||||||
import org.apache.poi.hssf.record.CalcModeRecord;
|
import org.apache.poi.hssf.record.CalcModeRecord;
|
||||||
|
@ -190,7 +191,7 @@ public final class InternalSheet {
|
||||||
while (rs.hasNext()) {
|
while (rs.hasNext()) {
|
||||||
int recSid = rs.peekNextSid();
|
int recSid = rs.peekNextSid();
|
||||||
|
|
||||||
if ( recSid == CFHeaderRecord.sid ) {
|
if ( recSid == CFHeaderRecord.sid || recSid == CFHeader12Record.sid ) {
|
||||||
condFormatting = new ConditionalFormattingTable(rs);
|
condFormatting = new ConditionalFormattingTable(rs);
|
||||||
records.add(condFormatting);
|
records.add(condFormatting);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -62,13 +62,17 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
|
||||||
|
|
||||||
public boolean getNeedRecalculation() {
|
public boolean getNeedRecalculation() {
|
||||||
// Held on the 1st bit
|
// 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) {
|
public void setNeedRecalculation(boolean b) {
|
||||||
// held on the first bit
|
// held on the first bit
|
||||||
if (b == getNeedRecalculation()) return;
|
if (b == getNeedRecalculation()) {
|
||||||
if (b) field_2_need_recalculation_and_id++;
|
return;
|
||||||
else field_2_need_recalculation_and_id--;
|
} else if (b) {
|
||||||
|
field_2_need_recalculation_and_id++;
|
||||||
|
} else {
|
||||||
|
field_2_need_recalculation_and_id--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getID() {
|
public int getID() {
|
||||||
|
@ -79,7 +83,9 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
|
||||||
// Remaining 15 bits of field 2
|
// Remaining 15 bits of field 2
|
||||||
boolean needsRecalc = getNeedRecalculation();
|
boolean needsRecalc = getNeedRecalculation();
|
||||||
field_2_need_recalculation_and_id = (id<<1);
|
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() {
|
public CellRangeAddress getEnclosingCellRange() {
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class HSSFExtendedColor extends ExtendedColor {
|
||||||
rgb[3] = a;
|
rgb[3] = a;
|
||||||
color.setRGBA(rgb);
|
color.setRGBA(rgb);
|
||||||
}
|
}
|
||||||
|
color.setType(TYPE_RGB);
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getTint() {
|
public double getTint() {
|
||||||
|
|
Loading…
Reference in New Issue