Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 56237 invoked from network); 12 Oct 2009 15:48:04 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Oct 2009 15:48:04 -0000 Received: (qmail 59151 invoked by uid 500); 12 Oct 2009 15:48:04 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 59114 invoked by uid 500); 12 Oct 2009 15:48:03 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 59104 invoked by uid 99); 12 Oct 2009 15:48:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 15:48:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 15:47:53 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1MxN7U-0004lb-Nu for user@poi.apache.org; Mon, 12 Oct 2009 08:47:32 -0700 Message-ID: <25858056.post@talk.nabble.com> Date: Mon, 12 Oct 2009 08:47:32 -0700 (PDT) From: nikhilgonsalves To: user@poi.apache.org Subject: Interesting Error - "Unexpected operation ptg class (org.apache.poi.hssf.record.formula.IntersectionPtg)" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: nikhil.gonsalves@gmail.com X-Virus-Checked: Checked by ClamAV on apache.org Hi all, We are reading an Excel document in which the formulae are dynamicall executed using the POI API. Almost all the formulae are executed successfully but for a few. THese ones use intersection between two ranges For example, there are two ranges - previous (which is a vertical range -- A:A) and test ( which is a horizontal range -- A1:C1). These two intersect at cell A1. The formula is cell C1 is "=A2*previous test". This works fine in Excel but when the same file is read and evaluated in POI, the error we get is below: java.lang.RuntimeException: Unexpected operation ptg class (org.apache.poi.hssf.record.formula.IntersectionPtg) at org.apache.poi.ss.formula.OperationEvaluatorFactory.create(OperationEvaluatorFactory.java:170) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateFormula(WorkbookEvaluator.java:295) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluateAny(WorkbookEvaluator.java:214) at org.apache.poi.ss.formula.WorkbookEvaluator.evaluate(WorkbookEvaluator.java:178) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluateFormulaCellValue(HSSFFormulaEvaluator.java:297) at org.apache.poi.hssf.usermodel.HSSFFormulaEvaluator.evaluate(HSSFFormulaEvaluator.java:159) The following code is used to evaluate a cells numeric value: HSSFCell hcell = row.getCell(colId); if (hcell != null){ FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); CellValue cell = evaluator.evaluate(hcell); return cell.getNumberValue(); CAn anyone help us? Thanks a lot! Nikhil -- View this message in context: http://www.nabble.com/Interesting-Error---%22Unexpected-operation-ptg-class-%28org.apache.poi.hssf.record.formula.IntersectionPtg%29%22-tp25858056p25858056.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org