Hi,
I'm trying to use the workbook.protectfile method, but without result !?
Does this work ?
Thanks,
Goddeau H.
Hi,
I'm trying to use the workbook.protectfile method, but without result !?
Does this work ?
Thanks,
Goddeau H.
Hi,
Thanks for considering Aspose.
Please check:
1. Workbook.protectFile() method protects a file in the way that you may remove or set a workbook protection password to the file.
Parameters:protectionType
- protection type.It could be one of the following values only:
ProtectionType.OPEN_FILE |
ProtectionType.MODIFY_FILE |
password - password to protect the workbook.
Ex1:
Workbook workbook = new Workbook();
//Open the protected workbook.
workbook.open("e:\\Files\\Book1.xls");
workbook.protectFile(ProtectionType.OPEN_FILE,null);
workbook.save("e:\\Files\\tstBook2.xls");
NOTE: if the protectionType is OPEN_FILE, Only supports to remove the password, not supports to set the password.
2. Workbook.protectWorkbook() method protects a workbook in the way that you may protect a book related its windows and structure. e.g., you may use it if you don't allow to change the size of your worksheets windows etc.
Parameters: protectionType
- protection type.It could be one of the following values only:
ProtectionType.WORKBOOK_ALL |
ProtectionType.STRUCTURE |
ProtectionType.WINDOWS |
password
- password to protect the workbook.
Ex2:
Workbook workbook = new Workbook();
//Open a sample book.
workbook.open("e:\\Files\\bk1.xls");
//Protect the workbook with password that you cannot change the worksheets windows size ans structure ect.
workbook.protectWorkbook(ProtectionType.WORKBOOK_ALL,"007");
workbook.save("e:\\Files\\outbk1.xls");
Note: WORKBOOK_ALL has both STRUCTURE and WINDOWS features.
3. If you want to protect a worksheet with different advanced attributes, you may use Worksheet.Protect(Proection) method: Protecting Worksheet and Advanced Protection since ExcelXP
And to get the latest fix for java please download it from the thread: <A href="</A></P> <P>Hopefully it will give you some insight</P> <P>Thank you.</P> <P> </P>
Thanks.
Removing the file protection works fine (--> pw=null), but setting FILE_MODIFY protection with pw doesn't work !
Hi,
Thanks, we will sort out related ProtectionType.MODIFY_FILE para.
Rgds.
Hi,
Please try this fix.
Thanks a lot !
Works fine now !
Goddeau Hendrik