Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 65624 invoked from network); 11 Jun 2009 08:28:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Jun 2009 08:28:25 -0000 Received: (qmail 52907 invoked by uid 500); 11 Jun 2009 08:28:36 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 52891 invoked by uid 500); 11 Jun 2009 08:28:36 -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 52881 invoked by uid 99); 11 Jun 2009 08:28:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 08:28:36 +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 (athena.apache.org: domain of borut.zagar@gmail.com designates 74.125.78.149 as permitted sender) Received: from [74.125.78.149] (HELO ey-out-1920.google.com) (74.125.78.149) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Jun 2009 08:28:28 +0000 Received: by ey-out-1920.google.com with SMTP id 3so181144eyh.0 for ; Thu, 11 Jun 2009 01:28:06 -0700 (PDT) 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=MQtUNWpwtCbfpbFx3NhiOjpjX0xgqOLrdFGJioef2uc=; b=ebQctLGhnZr2Ar75ZYUq7uUuPHh9v3XrEjXPPOTC54oZ4qKadcmvhFsPdZwAK/RgHf jW4DcyFi0PEyEOkFOi/7/SAehBmsJajlyyOoEXtvZTRCfQeh1stTHfRN4YjKbpITm7In RWkhJ3qECVvw4XPOYLhK2HmaqrXXiD9lziI0I= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=e1Yfdn57a9hjKK4W+leEGZn/ZO/E6J28AZAVLrK6EEwJ0rIyqVvD9LJHUXBQcywH9K b9sgfIuy3qLzFy8INdkO8MyP57zsnc5WmhNdxIL9fA/bbqbZez8aIjOZmvbBpDmswEBu 7ikUsgepJqmW/f2JLevSG0fhX3hdkai0wwWGA= MIME-Version: 1.0 Received: by 10.210.91.17 with SMTP id o17mr2805192ebb.77.1244708886306; Thu, 11 Jun 2009 01:28:06 -0700 (PDT) Date: Thu, 11 Jun 2009 10:28:04 +0200 Message-ID: <1323dc380906110128s4133669cidfd315ebe0979a9a@mail.gmail.com> Subject: HSSF, protected workbook, data validation From: =?windows-1252?Q?Borut_=8Eagar?= To: user@poi.apache.org Content-Type: multipart/alternative; boundary=0015174c3e9e04978a046c0e5f5f X-Virus-Checked: Checked by ClamAV on apache.org --0015174c3e9e04978a046c0e5f5f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi! I am using POI final 3.2, and I am creating a worksheet which I want it to be protected (certain cells cannot be edited). But I am getting an exception when adding a data validation to the worksheet. The exception is: java.lang.IllegalStateException: Unexpected (org.apache.poi.hssf.record.PasswordRecord) while looking for DV Table insert pos at org.apache.poi.hssf.model.RecordOrderer.findDataValidationTableInsertPos(RecordOrderer.java:240) at org.apache.poi.hssf.model.RecordOrderer.findSheetInsertPos(RecordOrderer.java:95) at org.apache.poi.hssf.model.RecordOrderer.addNewSheetRecord(RecordOrderer.java:89) at org.apache.poi.hssf.model.Sheet.getOrCreateDataValidityTable(Sheet.java:1752) at org.apache.poi.hssf.usermodel.HSSFSheet.addValidationData(HSSFSheet.java:369) at com.cmpny.product.bl.pr.PremiumsImporterExporterBL.addInputTypeDropdown(PremiumsImporterExporterBL.java:163) The code for adding data validation object is: CellRangeAddressList cral = new CellRangeAddressList(1, 1, 1, 1); HSSFDataValidation dataValidation = new HSSFDataValidation(cral, DVConstraint.createExplicitListConstraint(new String[] {"one", "two"})); dataValidation.setEmptyCellAllowed(false); dataValidation.setSuppressDropDownArrow(false); dataValidation.setShowPromptBox(false); dataValidation.createErrorBox("Wrong value", "Please select from list."); wb.getCurrentSheet().addValidationData(dataValidation); If I remove worksheet protection or remove adding of data validation object to workbook it all works fine so it seems that both together are not working. Regards, Borut --0015174c3e9e04978a046c0e5f5f--