diff options
author | Nick Burch <nick@apache.org> | 2014-07-30 23:06:46 +0000 |
---|---|---|
committer | Nick Burch <nick@apache.org> | 2014-07-30 23:06:46 +0000 |
commit | 07a56697013aa1f2c4319f8209daf7b6ab947ed8 (patch) | |
tree | 46c1e226f449d019fccb0ce1c124204db8ebc1e0 /src/java/org/apache/poi | |
parent | b45056e979d292cf0f4946b6ba595f27b0d9c806 (diff) | |
download | poi-07a56697013aa1f2c4319f8209daf7b6ab947ed8.tar.gz poi-07a56697013aa1f2c4319f8209daf7b6ab947ed8.zip |
Correct logic for the start-of-sheet missing rows, for event user model, and add tests for this
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1614789 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/poi')
-rw-r--r-- | src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java | 4 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java b/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java index ef15ea7ce7..503f8d81b1 100644 --- a/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java +++ b/src/java/org/apache/poi/hssf/eventusermodel/MissingRecordAwareHSSFListener.java @@ -86,7 +86,8 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener { // the workbook case BOFRecord.sid: BOFRecord bof = (BOFRecord) record; - if (bof.getType() == bof.TYPE_WORKBOOK || bof.getType() == bof.TYPE_WORKSHEET) { + if (bof.getType() == BOFRecord.TYPE_WORKBOOK || + bof.getType() == BOFRecord.TYPE_WORKSHEET) { // Reset the row and column counts - new workbook / worksheet resetCounts(); } @@ -106,6 +107,7 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener { // Record this as the last row we saw lastRowRow = rowrec.getRowNumber(); + lastCellColumn = -1; break; case SharedFormulaRecord.sid: @@ -144,7 +146,8 @@ public final class MissingRecordAwareHSSFListener implements HSSFListener { // If we're on cells, and this cell isn't in the same // row as the last one, then fire the // dummy end-of-row records - if(thisRow != lastCellRow && lastCellRow > -1) { + if(thisRow != lastCellRow && thisRow > 0) { + if (lastCellRow == -1) lastCellRow = 0; for(int i=lastCellRow; i<thisRow; i++) { int cols = -1; if(i == lastCellRow) { diff --git a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java index e063593016..0b41df9b77 100644 --- a/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java +++ b/src/java/org/apache/poi/hssf/eventusermodel/dummyrecord/LastCellOfRowDummyRecord.java @@ -44,4 +44,8 @@ public final class LastCellOfRowDummyRecord extends DummyRecordBase { * for the row. */ public int getLastColumnNumber() { return lastColumnNumber; } + + public String toString() { + return "End-of-Row for Row=" + row + " at Column=" + lastColumnNumber; + } } |