diff --git a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java index 6ceba5723..b12c869f4 100644 --- a/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java +++ b/src/java/org/apache/poi/hssf/record/CFHeaderRecord.java @@ -38,6 +38,7 @@ public class CFHeaderRecord extends StandardRecord { /** Creates new CFHeaderRecord */ public CFHeaderRecord() { + field_3_enclosing_cell_range = new CellRangeAddress(0, 0, 0, 0); field_4_cell_ranges = new CellRangeAddressList(); } public CFHeaderRecord(CellRangeAddress[] regions, int nRules) { @@ -158,7 +159,7 @@ public class CFHeaderRecord extends StandardRecord { CFHeaderRecord result = new CFHeaderRecord(); result.field_1_numcf = field_1_numcf; result.field_2_need_recalculation_and_id = field_2_need_recalculation_and_id; - result.field_3_enclosing_cell_range = field_3_enclosing_cell_range; + result.field_3_enclosing_cell_range = field_3_enclosing_cell_range.copy(); result.field_4_cell_ranges = field_4_cell_ranges.copy(); return result; } diff --git a/src/java/org/apache/poi/hssf/record/common/FtrHeader.java b/src/java/org/apache/poi/hssf/record/common/FtrHeader.java index 1df69cfcb..dba24f084 100644 --- a/src/java/org/apache/poi/hssf/record/common/FtrHeader.java +++ b/src/java/org/apache/poi/hssf/record/common/FtrHeader.java @@ -18,6 +18,7 @@ package org.apache.poi.hssf.record.common; import org.apache.poi.hssf.record.RecordInputStream; +import org.apache.poi.ss.util.CellRangeAddress; import org.apache.poi.util.LittleEndianOutput; /** @@ -32,19 +33,18 @@ public final class FtrHeader { private short recordType; /** This is a FrtFlags */ private short grbitFrt; - /** MUST be 8 bytes and all zero TODO Correct this! */ - private byte[] reserved; + /** The range of cells the parent record applies to, or 0 if N/A */ + private CellRangeAddress associatedRange; public FtrHeader() { - reserved = new byte[8]; + associatedRange = new CellRangeAddress(0, 0, 0, 0); } public FtrHeader(RecordInputStream in) { recordType = in.readShort(); grbitFrt = in.readShort(); - reserved = new byte[8]; - in.read(reserved, 0, 8); + associatedRange = new CellRangeAddress(in); } public String toString() { @@ -59,7 +59,7 @@ public final class FtrHeader { public void serialize(LittleEndianOutput out) { out.writeShort(recordType); out.writeShort(grbitFrt); - out.write(reserved); + associatedRange.serialize(out); } public static int getDataSize() { @@ -80,18 +80,18 @@ public final class FtrHeader { this.grbitFrt = grbitFrt; } - public byte[] getReserved() { - return reserved; + public CellRangeAddress getAssociatedRange() { + return associatedRange; } - public void setReserved(byte[] reserved) { - this.reserved = reserved; + public void setAssociatedRange(CellRangeAddress associatedRange) { + this.associatedRange = associatedRange; } public Object clone() { FtrHeader result = new FtrHeader(); result.recordType = recordType; result.grbitFrt = grbitFrt; - result.reserved = reserved; + result.associatedRange = associatedRange.copy(); return result; } } \ No newline at end of file diff --git a/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java b/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java index 234322671..4b5b10424 100644 --- a/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java +++ b/src/java/org/apache/poi/ss/util/CellRangeAddressBase.java @@ -24,8 +24,6 @@ import org.apache.poi.ss.SpreadsheetVersion; * See OOO documentation: excelfileformat.pdf sec 2.5.14 - 'Cell Range Address'
* * Common subclass of 8-bit and 16-bit versions - * - * @author Josh Micich */ public abstract class CellRangeAddressBase {