Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 79907 invoked from network); 12 Jan 2011 16:00:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Jan 2011 16:00:55 -0000 Received: (qmail 89607 invoked by uid 500); 12 Jan 2011 16:00:54 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 89403 invoked by uid 500); 12 Jan 2011 16:00:52 -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 89386 invoked by uid 99); 12 Jan 2011 16:00:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jan 2011 16:00:51 +0000 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=FREEMAIL_FROM,FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,RFC_ABUSE_POST,T_FRT_STOCK2,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: unknown (athena.apache.org: error in processing during lookup of markbrdsly@tiscali.co.uk) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 Jan 2011 16:00:44 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.69) (envelope-from ) id 1Pd37W-0005XZ-EQ for user@poi.apache.org; Wed, 12 Jan 2011 08:00:22 -0800 Date: Wed, 12 Jan 2011 08:00:22 -0800 (PST) From: Mark Beardsley To: user@poi.apache.org Message-ID: <1294848022440-3338391.post@n5.nabble.com> In-Reply-To: <1294828383845-3337913.post@n5.nabble.com> References: <1294412328208-3331946.post@n5.nabble.com> <8212E3E7-D19D-4839-8EF2-72C417232F43@apache.org> <1294422754655-3332212.post@n5.nabble.com> <1294732648350-3336022.post@n5.nabble.com> <1294747785126-3336369.post@n5.nabble.com> <1294828383845-3337913.post@n5.nabble.com> Subject: Re: Equivalent methods in Apache POI MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello again, 1) Will my new worksheet be created as the first sheet always? Can i specify the index of the sheet when creating it? Say workbook.createSheet("sheet1", 0) etc. Please clarify. The worksheet wil always be created as the sheet at the next available index number. So, when you create a new workbook, the first call to the createSheet(String) method will create the equivalent of 'Sheet 1' in Excel terms, the next call will create 'Sheet 2' and so on. There are only two watys to reate sheets using the SS usermodel and they are createSheet() and createSheet(String) and currently, there is no method to allow you to specify the index number of the sheet. What you cold do if it is imprtant to be able to determine where in the workbook the sheet appears is to use the setSheetOrder(String, int) to specify this. The two parameters to this method are the name of the sheet and the postion you want it to appear in the workbook. So, imagine you wanted to create a new sheet and insert it into an existing workbook as the second sheet, you would do something like this; Sheet newSheet = workbook.createSheet("New Sheet"); workbook.setSheetOrder("New Sheet", 1); Remember that sheets are indexed from zero and not from one. 2) How do i password protect the entire worksheet? is there a method defined for achieving this feature? Please let me know. There is no easy answer to this question as the technique will differ depenind upon whether you are dealing with the older binary format (HSSF) or the more recent SpreadsheetML file format (XSSF). Off of the top of my head, I cannot remember the exact steps for both and will need time to look over some olde code before answering. I do know that HSSF requires you to call the setLocked(boolean) method for each cell style but I cannot remember off hand the second step in the process. I do not think it currently support locking at the worksheet level but rather at the cell level also. XSSF supports finer grained locking that I have explained elsewhere so I know I have the code for this and can post it later. The drawbacks are obvious though; you will need to maintain two different codebases to support the different types of protection. Will post again later. Yours Mark B -- View this message in context: http://apache-poi.1045710.n5.nabble.com/Equivalent-methods-in-Apache-POI-tp3331946p3338391.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org