Return-Path: X-Original-To: apmail-poi-user-archive@www.apache.org Delivered-To: apmail-poi-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BAFAC9B51 for ; Fri, 10 Feb 2012 18:53:20 +0000 (UTC) Received: (qmail 38311 invoked by uid 500); 10 Feb 2012 18:53:20 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 37957 invoked by uid 500); 10 Feb 2012 18:53:19 -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 37941 invoked by uid 99); 10 Feb 2012 18:53:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2012 18:53:18 +0000 X-ASF-Spam-Status: No, hits=-10.8 required=5.0 tests=ENV_AND_HDR_SPF_MATCH,HTML_MESSAGE,RCVD_IN_DNSWL_HI,SPF_PASS,USER_IN_DEF_SPF_WL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of nawanit@amazon.com designates 72.21.196.25 as permitted sender) Received: from [72.21.196.25] (HELO smtp-fw-2101.amazon.com) (72.21.196.25) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Feb 2012 18:53:10 +0000 X-IronPort-AV: E=Sophos;i="4.73,397,1325462400"; d="scan'208,217";a="314961243" Received: from smtp-in-0105.sea3.amazon.com ([10.224.19.45]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Feb 2012 18:52:42 +0000 Received: from ex-hub-12011.ant.amazon.com (ex-hub-12011.ant.amazon.com [10.32.49.104]) by smtp-in-0105.sea3.amazon.com (8.13.8/8.13.8) with ESMTP id q1AIqebE017702 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Fri, 10 Feb 2012 18:52:41 GMT Received: from ex-hub-hyd1-4.ant.amazon.com (10.43.31.202) by ex-hub-12011.ant.amazon.com (10.32.49.104) with Microsoft SMTP Server (TLS) id 8.3.213.0; Fri, 10 Feb 2012 18:52:35 +0000 Received: from ex-mail-hyd1-1.ant.amazon.com ([fe80::556:4cdd:76c1:d940]) by ex-hub-hyd1-4.ant.amazon.com ([::1]) with mapi; Sat, 11 Feb 2012 00:22:25 +0530 From: "Nawanit, Niraj" To: POI Users List , "dev@poi.apache.org" Date: Sat, 11 Feb 2012 00:22:25 +0530 Subject: RE: problem while implementing dependent list in HSSF Thread-Topic: problem while implementing dependent list in HSSF Thread-Index: AczoDOa977Yz61ThTDiyNf1+K5FXmgAF5cKA Message-ID: <9CC8D6E4804E234A827D1782AE3DB7782EDDDB407A@EX-MAIL-HYD1-1.ant.amazon.com> References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_9CC8D6E4804E234A827D1782AE3DB7782EDDDB407AEXMAILHYD11an_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_9CC8D6E4804E234A827D1782AE3DB7782EDDDB407AEXMAILHYD11an_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Re-indented the code. Thanks Niraj -----Original Message----- From: Nawanit, Niraj Sent: Friday, February 10, 2012 9:32 PM To: dev@poi.apache.org; user@poi.apache.org Subject: problem while implementing dependent list in HSSF Hi all, I am trying to implement dependent list on a column for XLS format and XLSX= format. For this I have to use reference to another cell in same row insid= e the formula. I am using apache POI 3.7. I am using formula as such: "=3DINDIRECT(UPPER($A7))" for list for 7th row = onwards in 3rd column. I am facing weird problem. For HSSF implementation, = in Office 2003 and office 2007, for every row, formula refers $A$7. In Offi= ce 2010 I have not tested as of now. I want A8 to be referred for 8th row a= nd A9 to be referred for 9th row and so on. In XSSF implementation, this wo= rks quite well. The same problem I am facing for conditional formatting too. Can someone please help? I have provided my implementation below. Thanks in advance! Niraj import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.DataValidation; import org.apache.poi.ss.usermodel.DataValidationConstraint; import org.apache.poi.ss.util.CellRangeAddressList; import org.apache.poi.hssf.usermodel.DVConstraint; import org.apache.poi.xssf.usermodel.XSSFDataValidationConstraint; public static void addDropdown(Sheet sheet, String formula, int column, boo= lean isXSSF) { CellRangeAddressList cellRangeAddressList =3D new CellRange= AddressList(7, 500, column, column); DataValidationConstraint dvConstraint; If (isXSSF) { dvConstraint =3D new XSSFDataValidationCon= straint(DataValidationConstraint.ValidationType.LIST, formula); } else { dvConstraint =3D DVConstraint.createFormula= ListConstraint(formula); } DataValidation dataValidation =3D sheet.getDataValidationHe= lper().createValidation(dvConstraint, cellRangeAddressList); dataValidation.setShowErrorBox(true); } public static void main(String[] args) { Sheet sheet =3D ... // comes from somewhere addDropdown(sheet, "=3DINDIRECT(UPPER($A7))", 2, false); //= for hssf // addDropdown(sheet, "=3DINDIRECT(UPPER($A7))", 2, true); = // for xssf } --_000_9CC8D6E4804E234A827D1782AE3DB7782EDDDB407AEXMAILHYD11an_--