Return-Path: X-Original-To: apmail-poi-commits-archive@minotaur.apache.org Delivered-To: apmail-poi-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C038C18F8E for ; Fri, 31 Jul 2015 23:53:54 +0000 (UTC) Received: (qmail 98370 invoked by uid 500); 31 Jul 2015 23:53:54 -0000 Delivered-To: apmail-poi-commits-archive@poi.apache.org Received: (qmail 98334 invoked by uid 500); 31 Jul 2015 23:53:54 -0000 Mailing-List: contact commits-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@poi.apache.org Delivered-To: mailing list commits@poi.apache.org Received: (qmail 98325 invoked by uid 99); 31 Jul 2015 23:53:54 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 31 Jul 2015 23:53:54 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 8A54AAC035C for ; Fri, 31 Jul 2015 23:53:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1693674 - /poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Date: Fri, 31 Jul 2015 23:53:54 -0000 To: commits@poi.apache.org From: nick@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150731235354.8A54AAC035C@hades.apache.org> Author: nick Date: Fri Jul 31 23:53:54 2015 New Revision: 1693674 URL: http://svn.apache.org/r1693674 Log: Unit test for #55747 Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Modified: poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java?rev=1693674&r1=1693673&r2=1693674&view=diff ============================================================================== --- poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java (original) +++ poi/trunk/src/testcases/org/apache/poi/ss/usermodel/BaseTestBugzillaIssues.java Fri Jul 31 23:53:54 2015 @@ -1120,4 +1120,35 @@ public abstract class BaseTestBugzillaIs assertTrue("HSSF will currently return empty string, XSSF/SXSSF will return null, but had: " + value, value == null || value.length() == 0); } + + /** + * Formulas with Nested Ifs, or If with text functions like + * Mid in it, can give #VALUE in Excel + */ + @Test + public void bug55747() { + Workbook wb = _testDataProvider.createWorkbook(); + FormulaEvaluator ev = wb.getCreationHelper().createFormulaEvaluator(); + Sheet s = wb.createSheet(); + + Row row = s.createRow(0); + row.createCell(0).setCellValue("abc"); + row.createCell(1).setCellValue(""); + row.createCell(2).setCellValue(3); + + Cell cell = row.createCell(5); + cell.setCellFormula("IF(A1<>\"\",MID(A1,1,2),\" \")"); + ev.evaluateAll(); + assertEquals("ab", cell.getStringCellValue()); + + cell = row.createCell(6); + cell.setCellFormula("IF(B1<>\"\",MID(A1,1,2),\"empty\")"); + ev.evaluateAll(); + assertEquals("empty", cell.getStringCellValue()); + + cell = row.createCell(7); + cell.setCellFormula("IF(A1<>\"\",IF(C1<>\"\",MID(A1,1,2),\"c1\"),\"c2\")"); + ev.evaluateAll(); + assertEquals("ab", cell.getStringCellValue()); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org For additional commands, e-mail: commits-help@poi.apache.org