Fernando,
For my needs, I chose to protect every xls file I create.
To protect every workbook:
1) Open Workbook.java inside the model directory.
2) In the createProtect() method, change the boolean passes to the
setProtect method to true.
To protect every sheet:
1) Open Sheet.java inside the model directory.
2) Copy and paste the createProtect method from Workbook.java
3) Inside of the createSheet() method, add the line
"records.add(retval.createProtect());" above the createEOF() add.
Every xls file you create is now protected. No password is set, so
end-users with motivation and basic knowledge of Excel can unprotect the
sheet and muck it up. If you are just looking for idiot resistance, this
process works well.
Niall Kennedy
[EMAIL PROTECTED]
-----Original Message-----
From: fernando wong [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 18, 2002 3:36 PM
To: '[EMAIL PROTECTED]'
Subject: Creating a Protected Spreadsheet
Hi,
Does anyone know how to create a protected Excel spreadsheet using POI? I
tried to overwrite the createProtect() method of the Workbook object to
return true.
Currently the only way to do this is to create a Protected spreadsheet
first, and then copy from it.
If anyone can help with the implementation it will be great.
thanks,
fernando