bug 56958: slightly improve performance when checking array formulas
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1749219 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7da9b2cd67
commit
b9e9b0d41d
@ -735,15 +735,17 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void validateArrayFormulas(CellRangeAddress region) {
|
private void validateArrayFormulas(CellRangeAddress region) {
|
||||||
|
// FIXME: this may be faster if it looped over array formulas directly rather than looping over each cell in
|
||||||
|
// the region and searching if that cell belongs to an array formula
|
||||||
int firstRow = region.getFirstRow();
|
int firstRow = region.getFirstRow();
|
||||||
int firstColumn = region.getFirstColumn();
|
int firstColumn = region.getFirstColumn();
|
||||||
int lastRow = region.getLastRow();
|
int lastRow = region.getLastRow();
|
||||||
int lastColumn = region.getLastColumn();
|
int lastColumn = region.getLastColumn();
|
||||||
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) {
|
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) {
|
||||||
for (int colIn = firstColumn; colIn <= lastColumn; colIn++) {
|
|
||||||
HSSFRow row = getRow(rowIn);
|
HSSFRow row = getRow(rowIn);
|
||||||
if (row == null) continue;
|
if (row == null) continue;
|
||||||
|
|
||||||
|
for (int colIn = firstColumn; colIn <= lastColumn; colIn++) {
|
||||||
HSSFCell cell = row.getCell(colIn);
|
HSSFCell cell = row.getCell(colIn);
|
||||||
if (cell == null) continue;
|
if (cell == null) continue;
|
||||||
|
|
||||||
|
@ -380,16 +380,18 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
|
|||||||
* @throws IllegalStateException if candidate region intersects an existing array formula in this sheet
|
* @throws IllegalStateException if candidate region intersects an existing array formula in this sheet
|
||||||
*/
|
*/
|
||||||
private void validateArrayFormulas(CellRangeAddress region) {
|
private void validateArrayFormulas(CellRangeAddress region) {
|
||||||
|
// FIXME: this may be faster if it looped over array formulas directly rather than looping over each cell in
|
||||||
|
// the region and searching if that cell belongs to an array formula
|
||||||
int firstRow = region.getFirstRow();
|
int firstRow = region.getFirstRow();
|
||||||
int firstColumn = region.getFirstColumn();
|
int firstColumn = region.getFirstColumn();
|
||||||
int lastRow = region.getLastRow();
|
int lastRow = region.getLastRow();
|
||||||
int lastColumn = region.getLastColumn();
|
int lastColumn = region.getLastColumn();
|
||||||
// for each cell in sheet, if cell belongs to an array formula, check if merged region intersects array formula cells
|
// for each cell in sheet, if cell belongs to an array formula, check if merged region intersects array formula cells
|
||||||
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) {
|
for (int rowIn = firstRow; rowIn <= lastRow; rowIn++) {
|
||||||
for (int colIn = firstColumn; colIn <= lastColumn; colIn++) {
|
|
||||||
XSSFRow row = getRow(rowIn);
|
XSSFRow row = getRow(rowIn);
|
||||||
if (row == null) continue;
|
if (row == null) continue;
|
||||||
|
|
||||||
|
for (int colIn = firstColumn; colIn <= lastColumn; colIn++) {
|
||||||
XSSFCell cell = row.getCell(colIn);
|
XSSFCell cell = row.getCell(colIn);
|
||||||
if (cell == null) continue;
|
if (cell == null) continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user