poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Chien <hsiangan.ch...@utoronto.ca>
Subject EventUserModel - Getting the Formula String from FormulaRecord and Setting Formula
Date Tue, 06 May 2008 17:53:12 GMT
Hi All:

As subject. How would I get the text formula string from the 
FormulaRecord? Upon inspecting the code for cellGetFormula from the 
usermodel, it seems that the answer lies within the ptg object. But I 
have no idea what it is or how to manipulate it. HSSFCell.GetFormula() 
seem to call Formula.Parse feeding in a Workbook object (not 
HSSFWorkbook, i just assume it's the raw form of HSSFWorkbook) and the 
ptg object.

Secondly, is there a way of setting the formula for a cell without it 
getting parsed?


The reasons why I am asking the above questions is because I would like 
to copy and paste excel file in plain text without formatting at the 
same time bypassing the Excel App's tendency to parse link (because some 
cell link will be pasted without the sheet actually being there that is 
why the formula must not be parsed). I am trying to use such methods to 
relocate a large and potentially corrupted Excel file into a fresh new 
workbook.

I have had some success in using HSSFCell.SetCellValue(String) by 
setting the string to things like "=Sheet5!A1+B1" it will show up as 
String but it will not be parsed as formula (by Excel) until you do F2 
and press enter on each and every cell.


If somebody can show me some insight that would be much appreciated.


Thanks in advance.

Andy Chien

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


Mime
View raw message