diff options
author | Josh Micich <josh@apache.org> | 2008-10-27 21:30:02 +0000 |
---|---|---|
committer | Josh Micich <josh@apache.org> | 2008-10-27 21:30:02 +0000 |
commit | 8697fdb6d9a42d09034b9006105847e8f478c012 (patch) | |
tree | f23050bdd4922efbf1752e684b57e0f4239b5be1 /src/java/org/apache/poi/ss | |
parent | 4ea70e1da597ae41f4e67e96e0e4da0538abd302 (diff) | |
download | poi-8697fdb6d9a42d09034b9006105847e8f478c012.tar.gz poi-8697fdb6d9a42d09034b9006105847e8f478c012.zip |
Merged revisions 707953,708242,708252,708260,708262,708286 via svnmerge from
https://svn.apache.org/repos/asf/poi/trunk
........
r707953 | josh | 2008-10-26 01:17:06 -0700 (Sun, 26 Oct 2008) | 1 line
Bugzilla 45966 - added implementation for FIND function (patch from Torstein Tauno Svendsen).
........
r708242 | nick | 2008-10-27 10:26:52 -0700 (Mon, 27 Oct 2008) | 1 line
Link typo fix
........
r708252 | nick | 2008-10-27 10:59:39 -0700 (Mon, 27 Oct 2008) | 1 line
Patch from bug #46092 - fix hssf dev utility
........
r708260 | josh | 2008-10-27 11:12:09 -0700 (Mon, 27 Oct 2008) | 1 line
Removed obsolete class
........
r708262 | josh | 2008-10-27 11:16:44 -0700 (Mon, 27 Oct 2008) | 1 line
Bugzilla 46065 - added implementation for VALUE function
........
r708286 | josh | 2008-10-27 12:24:42 -0700 (Mon, 27 Oct 2008) | 1 line
Preparation for fix for bug 46009. (Bug visible on ooxml branch, but this change will expose the problem)
........
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@708325 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi/ss')
-rw-r--r-- | src/java/org/apache/poi/ss/util/CellRangeAddress.java | 12 | ||||
-rw-r--r-- | src/java/org/apache/poi/ss/util/CellRangeAddressList.java | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/java/org/apache/poi/ss/util/CellRangeAddress.java b/src/java/org/apache/poi/ss/util/CellRangeAddress.java index 0d910c6824..3cc70cf483 100644 --- a/src/java/org/apache/poi/ss/util/CellRangeAddress.java +++ b/src/java/org/apache/poi/ss/util/CellRangeAddress.java @@ -16,6 +16,7 @@ package org.apache.poi.ss.util; +import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.hssf.record.SelectionRecord; import org.apache.poi.util.LittleEndian; @@ -42,6 +43,17 @@ public class CellRangeAddress extends CellRangeAddressBase { LittleEndian.putUShort(data, offset + 6, getLastColumn()); return ENCODED_SIZE; } + public CellRangeAddress(RecordInputStream in) { + super(readUShortAndCheck(in), in.readUShort(), in.readUShort(), in.readUShort()); + } + + private static int readUShortAndCheck(RecordInputStream in) { + if (in.remaining() < ENCODED_SIZE) { + // Ran out of data + throw new RuntimeException("Ran out of data reading CellRangeAddress"); + } + return in.readUShort(); + } public CellRangeAddress copy() { return new CellRangeAddress(getFirstRow(), getLastRow(), getFirstColumn(), getLastColumn()); diff --git a/src/java/org/apache/poi/ss/util/CellRangeAddressList.java b/src/java/org/apache/poi/ss/util/CellRangeAddressList.java index 72b5882488..65474ef980 100644 --- a/src/java/org/apache/poi/ss/util/CellRangeAddressList.java +++ b/src/java/org/apache/poi/ss/util/CellRangeAddressList.java @@ -18,6 +18,8 @@ package org.apache.poi.ss.util; import java.util.ArrayList; import java.util.List; + +import org.apache.poi.hssf.record.RecordInputStream; import org.apache.poi.util.LittleEndian; /** @@ -51,7 +53,17 @@ public class CellRangeAddressList { this(); addCellRangeAddress(firstRow, firstCol, lastRow, lastCol); } + /** + * @param in the RecordInputstream to read the record from + */ + public CellRangeAddressList(RecordInputStream in) { + this(); + int nItems = in.readUShort(); + for (int k = 0; k < nItems; k++) { + _list.add(new CellRangeAddress(in)); + } + } /** * Get the number of following ADDR structures. The number of this * structures is automatically set when reading an Excel file and/or |