Small fix for when the start row didnt contain any cells.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8bd4b39387
commit
5bd3bb8e28
@ -136,7 +136,15 @@ public class ValueRecordsAggregate
|
|||||||
* that are attached to the rows in the range specified.
|
* that are attached to the rows in the range specified.
|
||||||
*/
|
*/
|
||||||
public int getRowCellBlockSize(int startRow, int endRow) {
|
public int getRowCellBlockSize(int startRow, int endRow) {
|
||||||
Iterator cellRec = new VRAIterator(this, startRow, endRow);;
|
//Make sure that the row has cells
|
||||||
|
while (!rowHasCells(startRow) && (startRow <= endRow))
|
||||||
|
startRow++;
|
||||||
|
if (startRow > endRow) {
|
||||||
|
//Couldnt find any cells between the row range provided.
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator cellRec = new VRAIterator(this, startRow, endRow);
|
||||||
int size = 0;
|
int size = 0;
|
||||||
while (cellRec.hasNext()) {
|
while (cellRec.hasNext()) {
|
||||||
CellValueRecordInterface cell = (CellValueRecordInterface)cellRec.next();
|
CellValueRecordInterface cell = (CellValueRecordInterface)cellRec.next();
|
||||||
@ -149,6 +157,8 @@ public class ValueRecordsAggregate
|
|||||||
|
|
||||||
/** Returns true if the row has cells attached to it */
|
/** Returns true if the row has cells attached to it */
|
||||||
public boolean rowHasCells(int row) {
|
public boolean rowHasCells(int row) {
|
||||||
|
if (row >= celltype.size())
|
||||||
|
return false;
|
||||||
IntList ctRow = (IntList) celltype.get(row);
|
IntList ctRow = (IntList) celltype.get(row);
|
||||||
return ((ctRow != null) && (ctRow.size() > 0));
|
return ((ctRow != null) && (ctRow.size() > 0));
|
||||||
}
|
}
|
||||||
@ -553,7 +563,9 @@ class VRAIterator implements Iterator {
|
|||||||
this.row = startRow;
|
this.row = startRow;
|
||||||
this.rowlimit = endRow;
|
this.rowlimit = endRow;
|
||||||
this.popindex = vra.populatedRows.indexOf(row);
|
this.popindex = vra.populatedRows.indexOf(row);
|
||||||
if (vra.getPhysicalNumberOfCells() > 0) {
|
if (this.popindex == -1) {
|
||||||
|
hasNext = false;
|
||||||
|
} else if (vra.getPhysicalNumberOfCells() > 0) {
|
||||||
next = findNextCell(null);
|
next = findNextCell(null);
|
||||||
hasNext = (next != null);
|
hasNext = (next != null);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user