> Most of the time, you should not have to deal with > FormulaParser directly (Same goes for Workbook).
Yes, but I need to analyse, i.e. parse, the formula to adjust some references. The HSSFCell and HSSFWorkbook use a workbook internally but I can't access it. So, is there any way to get or create a Workbook from a HSSFWorkbook? Best Regards, gerd > Most of the time you should be fine with simply using the api > in the > org.apache.poi.hssf.usermodel > org.apache.poi.hssf.usermodel.contrib > org.apache.poi.hssf.util > packages. > > As far as reading a cell formula is concerned, you may want to > have a look at: > > > http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFCell > .html#getCellFormula() > > and > > > http://jakarta.apache.org/poi/apidocs/org/apache/poi/hssf/usermodel/HSSFCell > .html#getCellType() > > > (HSSFCell.getCellFormula() invokes the FormulaParser internally) > > > HTH, > ~ amol > > > > > > > > > -----Original Message----- > > From: Gerd Mueller [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, May 24, 2005 5:48 AM > > To: [email protected]; [EMAIL PROTECTED] > > Subject: Re: cell rerference problem > > > > > > > > > Are you doing this with a new (ie, POI created ) workbook? Do the > > > sheets Table1 > > > and Table2 exist at the point you are doing this? > > > > I load an Excel-document that I've created with Excel and loop through > > some cells. So I get a HSSFWorkbook that contains some formulas. > > > > > Can you show us the code you are using (simplified)? See the > > > TestFormulas file > > > for example of how to use sheet references. > > > > The code for parsing and converting the formula is pretty > > straight forward: > > > > Workbook wb = Workbook.createWorkbook(); > > FormulaParser fParser = new FormulaParser( formula, wb ); > > fParser.parse(); > > Ptg[] ptgs = fParser.getRPNPtg(); > > > > // doing something here ... > > > > return fParser.toFormulaString( wb, ptgs ); > > > > Do I need to convert the HSSFWorkbook in a Workbook and if so, how? > > > > Best Regards, > > gerd > > > > > > > > Regards > > > - > > > AVik > > > > > > > > > Quoting Gerd Mueller <[EMAIL PROTECTED]>: > > > > > > > > > > > Hi all, > > > > > > > > I've got the following formula: > > > > > > > > SUMIF(Table1!F11:F9999,Table2!B11,Table1!Q11:Q9999) > > > > > > > > I read this with the FormulaParser and than convert it back to > > > > a string. The result is: > > > > > > > > SUMIF(!F11:F9999,!B11,!Q11:Q9999) > > > > > > > > Is this a bug and can it be fixed easily? > > > > > > > > Best Regards, > > > > gerd > > > > > > > > ________________________________________________________________ > > > > Gerd Mueller [EMAIL PROTECTED] > > > > SMB GmbH http://www.smb-tec.com > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > Mailing List: http://jakarta.apache.org/site/mail2.html#poi > The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ ________________________________________________________________ Gerd Mueller [EMAIL PROTECTED] SMB GmbH http://www.smb-tec.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/
