Bug 48539 - Implement MROUND and VAR
Implement MROUND and VAR
Status: RESOLVED FIXED
Product: POI
Classification: Unclassified
Component: XSSF
3.6-FINAL
PC Windows XP
: P1 normal with 5 votes (vote)
: ---
Assigned To: POI Developers List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2010-01-13 12:38 UTC by anh.n.phung
Modified: 2010-12-11 07:43 UTC (History)
1 user (show)



Attachments
xlsx that generate the error (12.81 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2010-01-13 12:38 UTC, anh.n.phung
Details

Note You need to log in before you can comment on or make changes to this bug.
Description anh.n.phung 2010-01-13 12:38:53 UTC
Created attachment 24842 [details]
xlsx that generate the error

Caused by: java.lang.RuntimeException: Not implemented yet
	at org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getNameXPtg(XSSFEvaluationWorkbook.java:93)
	at org.apache.poi.ss.formula.FormulaParser.function(FormulaParser.java:930)
	at org.apache.poi.ss.formula.FormulaParser.parseNonRange(FormulaParser.java:570)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:442)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:285)
	at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1131)
	at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1091)
	at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1078)
	at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1400)
	at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1500)
	at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1484)
	at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1441)
	at org.apache.poi.ss.formula.FormulaParser.Arguments(FormulaParser.java:1063)
	at org.apache.poi.ss.formula.FormulaParser.function(FormulaParser.java:948)
	at org.apache.poi.ss.formula.FormulaParser.parseNonRange(FormulaParser.java:570)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:530)
	at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:285)
	at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1131)
	at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1091)
	at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1078)
	at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1400)
	at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1500)
	at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1484)
	at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1441)
	at org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1421)
	at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1542)
	at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:193)
	at org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getFormulaTokens(XSSFEvaluationWorkbook.java:134)
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:255)
	at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:203)
	at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCellValue(XSSFFormulaEvaluator.java:252)
	at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateFormulaCell(XSSFFormulaEvaluator.java:145)
	at org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator.evaluateAllFormulaCells(XSSFFormulaEvaluator.java:242)
	... 12 more
Comment 1 anh.n.phung 2010-02-19 19:58:08 UTC
Same file produces following error in 3.6
------
Exception in thread "Thread-5" java.lang.NoClassDefFoundError: Could not
initialize class org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs
        at
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$Factory.newInstance(Unknown
Source)
        at org.apache.poi.xssf.model.StylesTable.writeTo(StylesTable.java:362)
        at org.apache.poi.xssf.model.StylesTable.commit(StylesTable.java:377)
        at
org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:177)
        at
org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:181)
        at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:214)
Comment 2 Nick Burch 2010-02-19 20:41:58 UTC
When you got the class not found exception, were you using the full ooxml schemas jar, or just the poi-ooxml-schemas small one?

If the latter, please re-try with the full one. If that helps, we'll need a unit test that uses the class in question, so that the "what should I put in the small jar" processor knows that things use it!
Comment 3 anh.n.phung 2010-02-19 20:56:08 UTC
I used poi-ooxml-schemas-3.6-20091214.jar and the other jars downloaded with 3.6.  Switching back to using the 3.5FINAL, the class is there.

I might have some time to look at this problem and others I encountered. What is the best place to start.  Most of the problems I have is related to the newer xlsx format.
Comment 4 Nick Burch 2010-05-26 11:22:07 UTC
I can confirm that this problem is still present in head

The problem formula seems to be:
  IF(B6= (ROUNDUP(B6,0) + ROUNDDOWN(B6,0))/2, MROUND(B6,2),ROUND(B6,0))

I have added a disabled unit test to TestXSSFBugs for this, which can be enabled once the bug is fixed

Josh - probably one for you though, as it seems to be quite deep in the bowels of the XSSF Formula Evaluator that it's failing
Comment 5 Yegor Kozlov 2010-12-10 11:43:22 UTC
POI prior to 3.8-alpha did not support evaluation of functions from the Excel Analysis Toolpack (ATP). The ATP functions are now supported and evaluation of the entire workbook completes with two errors:

Not Implemented: MROUND 
Not Implemented: VAR


Yegor
Comment 6 Yegor Kozlov 2010-12-11 07:43:05 UTC
MROUND and VAR were added in r1044642. Now the attached workbook evaluates OK.

Try the latest build from trunk. Daily builds can be downloaded form here:
http://encore.torchbox.com/poi-cvs-build/


Yegor