java - Apache POI Evaluate Formula in SXSSF workbook -


in project use sxssfworkbook (apache-poi 3.9) class manage large spreadsheet. need evaluate formulas cells, tried formulaevaluator this

... sxssfworkbook streamingworkbook = new sxssfworkbook(100); ... formulaevaluator fe = streamingworkbook.getcreationhelper().createformulaevaluator(); ... fe.evaluateincell(cell); 

but doing so, exception thrown

java.lang.classcastexception: org.apache.poi.xssf.streaming.sxssfcell cannot cast org.apache.poi.xssf.usermodel.xssfcell @     org.apache.poi.xssf.usermodel.xssfformulaevaluator.evaluateincell(xssfformulaevaluator.java:177) @ org.apache.poi.xssf.usermodel.xssfformulaevaluator.evaluateincell(xssfformulaevaluator.java:44) 

...

the direct cause of error clear: method .evaluateincell takes cell object, internally casts cell xssfcell. since i'm passing instead sxssfcell exception thrown.

so question is: there way implement formula evaluation in streaming workbooks (sxssf)?

tl;dr - support need isn't in older 3.9 version you're using, you'll need upgrade 3.13 beta 2 or later.

your problem you're using old version of apache poi. that's why you're getting exceptions when try evaluate sxssf cells. detailed towards end of formula evaluation documentation, sxssf formula evaluation, need using 3.13 beta 2 or later.

one thing aware of though - formula evaluation needs not cell formula in in memory, other cells refers to, , refer to. such, call formulaevaluator.evaluateall() unlikely work; you'll need evaluate cells one-by-one after writing. you'll struggle formulas refer on place, they'll work if cells refer in current window, , haven't been flushed disk.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -