如何找出Excel工作表中公式运算符使用Apache POI 3.6? [英] How to find out excel sheet formula operator using apache poi 3.6?

查看:218
本文介绍了如何找出Excel工作表中公式运算符使用Apache POI 3.6?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样C1 + C2.suppose单元格公式我使用getcellformula()方法返回字符串C1 + C2。现在我想分裂由操作字符串,并获得每个单元地址separately.Is反正有没有找出Excel公式运算符,并分别获得每个单元格地址。我该怎么办?

I have cell formula like C1+C2.suppose i use getcellformula()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?

请回复我...

Saravanan.p

Saravanan.p

推荐答案

<一个href=\"http://stackoverflow.com/questions/4273871/how-to-use-org-apache-poi-ss-formula-formulaparser-to-parse-the-formula/4274191#4274191\">This回答您的其他问题会回答这一点。

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

一个公式 = D4 + D6 时通过的 FormulaParser

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指向单元格引用 D4 + AddPtg

请注意POI使用逆波​​兰式即它把这使在运营商修复后位置。

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

在逆波兰式的
  运营商按照他们的操作数;对于
  例如,以添加三和四一
  会写3 + 4,而不是3 +
  4。

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".

这篇关于如何找出Excel工作表中公式运算符使用Apache POI 3.6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆