Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 2698 invoked from network); 9 Jan 2010 13:56:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 9 Jan 2010 13:56:41 -0000 Received: (qmail 95727 invoked by uid 500); 9 Jan 2010 13:56:41 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 95670 invoked by uid 500); 9 Jan 2010 13:56:41 -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 Delivered-To: moderator for user@poi.apache.org Received: (qmail 12648 invoked by uid 99); 9 Jan 2010 12:01:18 -0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of amir.riaz.dwh@gmail.com designates 209.85.160.46 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=v8zGBTVc7A1W3QTL0UfW5DlF7/5Ia3Z/zPzfgFUC4Dw=; b=tHH8Hgzj5sYSMcKZqazcFnK/Fo4pb1zKc0UKiCw+5h4w/dxY7BbiupY4t+OElkpvSb 49Ojf2p35KJ5mCwHSgdYWyfremnMh2RPQywyuVaSfrfXVT4VoFnGmzmFmcx5LoaK9u/o UD/NGbinVE+HFc9/rQxtWTZzDZ1oyb9+BesJY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=X8e3+X1G67FF9AnsJunaDXysFOmnkQR4vtCbHpfuzp1nuQHvWz0Uqa46R3x+TD2tFz 7dZy+zYw7xTTwk/5c0eibX0vb95VI6ud+om8xxkpvaE+7KQsS4ryibCkE6O9Wm8crd1g Mj9hM+CjA9CAtxAuHSs5BhZEvRs1AiBk8sScU= MIME-Version: 1.0 Date: Sat, 9 Jan 2010 17:00:48 +0500 Message-ID: <1d5ba5611001090400y52d7d5e1w558024fa245d035c@mail.gmail.com> Subject: not able to calculate the formulas properly From: Amir Riaz To: user@poi.apache.org Content-Type: multipart/alternative; boundary=001636b147431754be047cba0e3f X-Virus-Checked: Checked by ClamAV on apache.org --001636b147431754be047cba0e3f Content-Type: text/plain; charset=UTF-8 I have the following code to evaluate the formula switch (cell.getCellType()) { case Cell.CELL_TYPE_FORMULA: { try { CellValue cval = this.evaluator.evaluate(cell); switch (cval.getCellType()) { case Cell.CELL_TYPE_NUMERIC: { if (DateUtil.isCellDateFormatted(cell)) { rowData.append(dateFormat.format(cval.getNumberValue())); hasData = true; } else { rowData.append(numberFormat.format(cval.getNumberValue())); hasData = true; } break; } case Cell.CELL_TYPE_STRING: { rowData.append(cval.getStringValue().trim().replaceAll("\n", "")); hasData = true; break; } case Cell.CELL_TYPE_BOOLEAN: { rowData.append(cval.getBooleanValue()); hasData = true; break; } case Cell.CELL_TYPE_ERROR: { int eval=cval.getErrorValue(); if (eval==DIVIDE_BY_ZERO) rowData.append("0"); hasData = true; break; } case Cell.CELL_TYPE_BLANK: { rowData.append(""); hasData = true; break; } } } after conversion two sheet correct values but the third sheet contain complex formula and values are not calculate correctly --001636b147431754be047cba0e3f--