开发者

How to find out excel sheet formula operator using apache poi 3.6?

开发者 https://www.devze.com 2023-01-26 10:34 出处:网络
I have cell formula like C1+C2.suppose i use get开发者_开发百科cellformula()method it returns the String C1+C2. Now i want to split the String by operator and get the each cell Address separately.Is t

I have cell formula like C1+C2.suppose i use get开发者_开发百科cellformula()method it returns the String C1+C2. Now i want to split the String by operator and get the each cell Address separately.Is there anyway to find out the Excel formula operator and get the each cell address separately. How i do?

Please reply me...

Saravanan.p


This answer to your other question will answer this as well.

A formula =D4+D6 when parsed via FormulaParser gives

org.apache.poi.hssf.record.formula.RefPtg [D4]
org.apache.poi.hssf.record.formula.RefPtg [D6]
class org.apache.poi.hssf.record.formula.AddPtg

RefPtg points to the cell reference D4, and + is AddPtg

Note POI uses the format of Reverse Polish Notation i.e. it puts which puts the operator in the post-fix position.

In Reverse Polish notation the operators follow their operands; for instance, to add three and four, one would write "3 4 +" rather than "3 + 4".

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号