}
}
public Cell[][][] getCellsArray() {
final Book book = getSheet().getBook();
final Sheet sheetTo = getSheetTo();
Cell[][][] cella = null;
int startj = -1;
if (sheetTo != null) { //3d range
final Sheet sheetFrom = getSheet();
int j = 0;
int endj = -1;
for(final Iterator it = book.getSheets().iterator(); it.hasNext(); ++j) {
final Sheet sheet = (Sheet) it.next();
if (sheet == sheetFrom) {
startj = j;
} else if (sheet == sheetTo) {
endj = j;
break;
}
}
if (startj < 0 || endj < 0) { //reach sheetTo first, reverse sequence.
throw new SSErrorXelException(SSError.REF);
}
final int sheetsz = endj - startj + 1;
cella = new Cell[sheetsz][][];
} else { //2d range
startj = 0;
cella = new Cell[1][][];
}
final int sheetsz = cella.length;
final int top = getTop();
final int left = getLeft();
final int rowsz = getBottom() - top + 1;
final int colsz = getRight() - left + 1;
int sj = 0;
for (final ListIterator it = book.getSheets().listIterator(startj); it.hasNext() && sj < sheetsz; ++sj) {
final Sheet sheet = (Sheet) it.next();
cella[sj] = new Cell[rowsz][];
for (int rj = 0; rj < rowsz; ++rj) {
cella[sj][rj] = new Cell[colsz];
for (int cj = 0; cj < colsz; ++cj) {
cella[sj][rj][cj] = sheet.getCell(top+rj, left+cj);
}
}
}
return cella;
}