Hello.

I am working with POI HSSF to read and write an .xls spreadsheet.

In my spreadsheet I have some cells with formulas, but I need to have values
in the cells, not formulas.

I tried to evaluate each cell of type CELL_TYPE_FORMULA and change the cell
values with the obtained results using this code.

for (Iterator cit = row.cellIterator(); cit.hasNext();) {
        HSSFCell c = (HSSFCell) cit.next();
        if (c.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {
                evaluator.evaluateInCell(c);
        }
}

With the most of cells this works fine, i.e. cell wich have a formula that
is a single link to another cell (i.e. =VDC!CM20), but I have problems with
cells wich have more complex formulas like this:

=SI(Y(RESIDUO(SUMA(VDC!$BB$52:$BF$81);2)=0;RESIDUO(SUMA(VAC!$BB$52:$BF$81);2)=0;RESIDUO(SUMA(IDC!$BB$52:$BF$81);2)=0;RESIDUO(SUMA(IAC!$BB$52:$BF$81);2)=0;RESIDUO(SUMA(R!$BB$52:$BF$81);2)=0;RESIDUO(SUMA('f'!$BB$52:$BF$81);2)=0;RESIDUO(SUMA('C'!$BB$52:$BF$81);2)=0);"";VDC!DG20)
(NOTE: My Excell is in Spanish)

The code I wrote before works with this formula, but it is very very very
slow, it needs around 20 seconds to evaluate this formula. I don't know why
do this happen.

Can somebody help me???

I need evaluate this formulas in a quick mode. You can suggest me other
fragments of code or totally different solutions, I only need to change this
complex formulas with its resulting values. It is very important for me
solving this problem.

Thank you very much.
-- 
View this message in context: 
http://www.nabble.com/Problem-evaluating-formulas-tp17642921p17642921.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