You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by hartford123 <ka...@yahoo.com> on 2011/01/25 20:35:41 UTC

macros not enabled with POI 3.7 version


I have excel template with macros created with in it. My application uses
2.5 version of POI and access this template and evaluates the macros ,  but
the problem is comign with POI version 3.7 ,recently we upgraded to 3.7 ,
now accessing the same templates(.xls files) is not evaluating the macros
within the template. 

 what is that problem that is causing it. can anybody help me.


thanks,
Sujatha.
-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/macros-not-enabled-with-POI-3-7-version-tp3356831p3356831.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: macros not enabled with POI 3.7 version

Posted by hartford123 <ka...@yahoo.com>.


OK. I figured out myself by google search.

I forced the macros to function by using FormulaEvaluator as follows

       FormulaEvaluator evaluator =
wb.getCreationHelper().createFormulaEvaluator();
        for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++)
{
            Sheet sheet = wb.getSheetAt(sheetNum);
            for(Row r : sheet) {
                for(Cell c : r) {
                    if(c.getCellType() == Cell.CELL_TYPE_FORMULA) {
                        evaluator.evaluateFormulaCell(c);
                    }
                }
            }
        }

-- 
View this message in context: http://apache-poi.1045710.n5.nabble.com/macros-not-enabled-with-POI-3-7-version-tp3356831p3361554.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org