poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 50384] Some formulas/macros are giving #VALUE! error on Excel file(.XLS).
Date Wed, 01 Dec 2010 06:41:33 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=50384

--- Comment #3 from Aniket <contact.aniket@gmail.com> 2010-12-01 01:41:30 EST ---
Thanks all for your kind reply. :)
I tried to use FormulaEvaluator.evaluateInCell(Cell cell);
But it throws Not Implemented Yet exception.

Stack trace :
org.apache.poi.ss.formula.eval.NotImplementedException: Error evaluating cell
'Pivot Data'!B2
at
org.apache.poi.ss.formula.WorkbookEvaluator.addExceptionInfo(WorkbookEvaluator.java:321)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:288)
at
org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:221)
at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:320)
at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateInCell(HSSFFormulaEvaluator.java:240)
at
org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateInCell(HSSFFormulaEvaluator.java:46)


But when I click on the cell on the excel file and press enter formula gets
evaluated. And for other simpler formulas I am not evaluating so excel does it
itself but in case of the above mentioned formulas it is giving #VALUE! error
on the excel file.

@Yegor : Our code is simple we do not do any manipulation with the formulas. We
save the formulas and it's coordinate and later just populate them on the excel
sheet :

 for (ExcelCoordinate formulaCoordinate : formulaCoordinates) {
      try {
        Sheet sheet = workbook.getSheetAt(formulaCoordinate.getSheet());
        if(sheet == null) {
          continue;
        }
        if(sheet.getSheetName().equals("Pivot Data") && !isCloned) {
          workbook.cloneSheet(formulaCoordinate.getSheet());
          isCloned = true;
        }
        Row row = sheet.getRow(formulaCoordinate.getRow());
        if(row == null) {
          continue;
        }
        Cell cell = ExportUtil.getCell(row, formulaCoordinate.getColumn());
        if(cell == null) {
          continue;
        }
        cell.setCellFormula(formulaCoordinate.getName());
        cell.setCellType(Cell.CELL_TYPE_FORMULA);
        //Cell evalutedCell = evaluator.evaluateInCell(cell);            
      }

Also if possible help me out with how can I stop this #VALUE! error and let
Excel do it's calcualtion.

Please Help!!!

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


Mime
View raw message