Return-Path: X-Original-To: apmail-poi-dev-archive@www.apache.org Delivered-To: apmail-poi-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B1081D2EC for ; Fri, 9 Nov 2012 14:38:09 +0000 (UTC) Received: (qmail 56190 invoked by uid 500); 9 Nov 2012 14:38:09 -0000 Delivered-To: apmail-poi-dev-archive@poi.apache.org Received: (qmail 56006 invoked by uid 500); 9 Nov 2012 14:38:09 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 55970 invoked by uid 99); 9 Nov 2012 14:38:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 14:38:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.115] (HELO eir.zones.apache.org) (140.211.11.115) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Nov 2012 14:38:05 +0000 Received: by eir.zones.apache.org (Postfix, from userid 80) id 74F5AAE4D; Fri, 9 Nov 2012 14:37:44 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.apache.org Subject: [Bug 54125] New: Setting an external API formula in a cell Date: Fri, 09 Nov 2012 14:37:44 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: XSSF X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: aurimas.sabalys@outlook.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: priority bug_id assigned_to short_desc bug_severity classification reporter rep_platform bug_status version component product Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://issues.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=54125 Priority: P2 Bug ID: 54125 Assignee: dev@poi.apache.org Summary: Setting an external API formula in a cell Severity: normal Classification: Unclassified Reporter: aurimas.sabalys@outlook.com Hardware: All Status: NEW Version: 3.8 Component: XSSF Product: POI I'm building an excel workbook that contains some formulas provided by Bloomberg Excel Add-in. Specifically =BDP(security, field) In order to set the cell formula I have to define a Name: workbook = new XSSFWorkbook(); Name name = workbook.createName(); name.setNameName("BDP"); name.setFunction(true); Further in the code some cell values are set as follows: excelCell.setCellFormula(cellValue); // here cellValue is a formula string built elsewhere in the code, e.g. =BDP("GOOG Equity","CHG_PCT_YTD")/100 The problem appears appears when opening the generated Excel file. First a message appears "Excel found unreadable content in 'filename.xlsx'. Do you want to recover the contents of this workbook. If you trust the source of this workbook, click Yes" Clicking YES opens the excel successfully, and a message is displayed "Removed Records: Named range from /xl/workbook.xml part (Workbook)". The cells with bloomberg formulas work OK. It seems that the only way to bypass the message during the file opening is to call name.setRefersToFormula(String) - but I cannot do this, since the name is not really a reference, it's simply an external formula. Not setting the name on a workbook doesn't work either, since excelCell.setCellFormula throws an exception "org.apache.poi.ss.formula.FormulaParseException: Name 'BDP' is completely unknown in the current workbook" I think Cell.setCellFormula should contain some parameter that would allow setting an external formula in it without throwing an exception. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org