Hello Nick,

first, please apologize my imprecise problem description I've posted
recently. To be more precise this time, I've prepared an example showing
what my problem with "evaluate" is.

I've uploaded a sheet called "Test.xls" 
http://www.nabble.com/file/p18357579/Test.xls Test.xls , which I query using
the following program:

import java.io.FileInputStream;

import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;

public class Test {

        public static void main(String[] args) throws Exception{
                final HSSFWorkbook book = new HSSFWorkbook(new
FileInputStream("c:\\Test.xls"));
                final String SHEET = "Eingabe";
                final int row = 6;
                final HSSFSheet document = book.getSheet(SHEET);
                final HSSFRow excelRow = document.getRow(row);
                for (short i = 4; i < 15; i++) {
                        final HSSFCell excelCell = excelRow.getCell(i);
                        final HSSFFormulaEvaluator evaluator = new
HSSFFormulaEvaluator(book.getSheet(SHEET), book);

                        evaluator.setCurrentRow(excelRow);
                        long now = System.currentTimeMillis();
                        evaluator.evaluate(excelCell);
                        System.out.println("evaluation took: " + 
(System.currentTimeMillis() -
now));
                }
        }
}

And here are the results I've received (in millis):

evaluation for cell (6, 4) took: 0
evaluation for cell (6, 5) took: 15
evaluation for cell (6, 6) took: 0
evaluation for cell (6, 7) took: 31
evaluation for cell (6, 8) took: 94
evaluation for cell (6, 9) took: 156
evaluation for cell (6, 10) took: 391
evaluation for cell (6, 11) took: 1406
evaluation for cell (6, 12) took: 5188
evaluation for cell (6, 13) took: 20265
evaluation for cell (6, 14) took: 81766

Perhaps "evaluateInCell" would help me out here, but I think that poi should
be able to evaluate such kind of formulas in an acceptable way.



Kind regards,
Matthias
-- 
View this message in context: 
http://www.nabble.com/performance-difference-between-HSSFFormulaEvaluator-evaluateInCell-and-evaluateFormulaCell-tp15618583p18357579.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to