Just had another thought. You might want to try the cloneSheet() method defined on the XSSFWorkbook class if you do not know in advance how many sheets to create in your template. I do not know if it will work but it should be very easy to try;
1. Create the template using and protect just the first sheet in that workbook. 2. While the workbook is still open in Excel, delete all other sheets so that the workbook now contains just the one, protected, sheet. 3. Save the template file away using the .xlsx extension (actually, I do not know if you could save it as a real template file or not, I did not try but you might like to). 4. Close the template file. Open the template file using POI and; 1. Clone the first sheet. 2. Populate the first sheet with data. 3. If you need a second sheet, clone the sheet you cloned; the copy of sheet one so that you now have three sheets in the workbook. 4. Populate the second sheet. Continue in this way until you have created and populated all the sheets you require. Finally, all you need to do is delete the extra cloned sheet. I do not know if the cloning process will 'copy' the protection but I can see no reason it should not. Either way, it should be easy enough to try this out and I will leave that to you now as I have closed down my IDE and plan to spend a quite evening listening to what I regard as good music - Richard Thompson for tonight I think. All the best. Yours Mark B Bugzilla from [email protected] wrote: > > https://issues.apache.org/bugzilla/show_bug.cgi?id=48900 > > --- Comment #2 from [email protected] 2010-03-15 15:29:19 UTC --- > (In reply to comment #1) >> Please don't abuse Bugzilla. Changing the priority of a bug to Blocker >> will not >> help us to fix it sooner. >> If you are really interested in fixing this issue - you are welcome to do >> a >> research and figure out which bits of the SpreadsheetML are missing. If >> you >> need a >> guidance, please ask, I will be happy to help. >> Yegor > > > Hey Yegor, > > we have the same method sheet.protectSheet("qq"); in the HSSF API and i > need > the same for XSSF API. > > Let me know if there is any workaround in XSSF API to protect worksheet > with a > password. > > This a kind of show stopper for my project currently. Any help is > appreciated. > > Thanks, > Vivek > > -- > Configure bugmail: > https://issues.apache.org/bugzilla/userprefs.cgi?tab=email > ------- You are receiving this mail because: ------- > You are the assignee for the bug. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > > -- View this message in context: http://old.nabble.com/DO-NOT-REPLY--Bug-48900--New%3A-XSSF-doesn%27t-have-the-method-protectSheet-as-we-have-for-HSSF-API-tp27878972p27907996.html Sent from the POI - Dev mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
