hello aspose
how to lock and password protect my excel sheet with out cracking plz send some examples.plz
This message was posted using Page2Forum from Advanced Protection Settings since Excel XP - Aspose.Cells for .NET and Java
hello aspose
how to lock and password protect my excel sheet with out cracking plz send some examples.plz
Hi,
To protect a worksheet (with password), see the following example:
//Instantiating a Workbook object
Workbook excel=new Workbook();
//Opening the Excel file
excel.open("c:\\book1.xls");
Worksheets worksheets = excel.getWorksheets();
Worksheet worksheet = worksheets.getSheet(0);
Protection protection = new Protection();
//The following 3 methods are only for Excel 2000 and earlier formats
protection.setEditingContentsAllowed(false);
protection.setEditingObjectsAllowed(false);
protection.setEditingScenariosAllowed(false);
//Protects the first worksheet with a password "1234"
protection.setPassword("1234");
worksheet.protect(protection);
//The following line equals to workbook.write("protected1234.xls", FileFormatType.Excel2003);
excel.save("C:\\protected1234.xls");
For further ref, please see the document:
And to encrypt an excel file including simple and strong encryption attribute, please see the document:
Thank you.
hello
thanks for ur reply .it was not asking when iam changing disabling the sheet in the tools.and it edited for change also that is the problem.so iam choosing lock plz send me the example for iterator object.plz
Hi,
Well, my sample code which I pasted in my last example works fine. Please find attached the output file "protected1234.xls". Kindly check the first worksheet which is password protected.
Which version of Aspose.Cells for Java you are using? Please try our latest version v2.0.1.x. If you still find the issue, kindly create a simple code and paste it here and post your template file here, we will check it soon.
Thank you.
hello i wrote a code like tthis and iam using “unix”.it is working fine but we can unlock by simple deselect the “sheet” in “protect sheet” in tools of excel it is not asking the password for un locking .we can change the content.i want it work full secured plz sugest some answer.plz
OutputStream out = response.getOutputStream();
response.setContentType(“application/vnd.ms-excel”);
response.addHeader(“content-disposition”, “inline; filename=” + “SaveSheet.xls”);
Workbook workbook = new Workbook();
Worksheets worksheets = workbook.getWorksheets();
Worksheet worksheet = worksheets.getSheet(0);
Cells cells = worksheet.getCells();
com.aspose.cells.Cell cell = null;
cell = cells.getCell(“A1”);
cell.setValue(“a1”);
cell = cells.getCell(“B1”);
cell.setValue(“b1”);
cell = cells.getCell(“C1”);
cell.setValue(“c1”);
cell = cells.getCell(“D1”);
cell.setValue(“d1”);
cell = cells.getCell(“E1”);
cell.setValue(“e1”);
com.aspose.cells.Style style = cell.getStyle();
int i=2;
for (Iterator iter = userlist.iterator(); iter.hasNext() {
User element = (User) iter.next();
com.aspose.cells.Row rowi = worksheet.getRow(((short)i));
rowi.getCell(((short)0)).setValue(element.geta1());
rowi.getCell(((short)1)).setValue(element.getb1());
rowi.getCell(((short)2)).setValue(element.getc1());
rowi.getCell(((short)3)).setValue(element.getd1());
String status=null;
if (element.getStatus()==Constants.ACTIVE_STATUS) {
status=Constants.ACTIVE;
}
if (element.getStatus()==Constants.DELETED_STATUS) {
status=Constants.DELETED;
}
if (element.getStatus()==Constants.INACTIVE_STATUS) {
status=Constants.INACTIVE;
}
rowi.getCell(((short)4)).setValue(status);
i++;
}
Protection protection = new Protection();
// protection.setSelectingLockedCellsAllowed(false);
// protection.setEditingContentsAllowed(false);
// protection.setEditingObjectsAllowed(false);
// protection.setEditingScenariosAllowed(false);
protection.setPassword(“1234”);
worksheet.protect(protection);
workbook.save(out);
hello thank u.iam just post the sample code plz verify it as soon as posible.
Hi,
Could you try the attached version. If you still find the issue, kindly post your generated excel file here, we will check your issue soon.
Thank you.
hello
i alread posted u the code wht i have written in unix and now iam sending u the excel genareted plz verify and sugeet me wht i have to do .if password prottection is not posible plz plz send me the lhow to lock that table from editing and changing is importent how it is not importent.ok iam sending the generated excel file.
Hi,
Thanks for providing us the template file.
We will look into your issue and get back to you soon.
Thanks for being patient!
hello i tested ur protected1234.xls which u have sended to me for testing.but it is also unlocked with out asking any password by deselecting the sheet in protected sheet in tools in my iam unable to understand wht is the problem.plz verify it once.
Hi,
Thank you for considering Aspose.
Well, we have tested your issue further and we were unable to reproduce your mentioned issue.We found out one issue though regarding unprotecting a protected excel file using the Open Office. If you are using Open Office then Open Office will not prompt for a password while unprotecting a password protected worksheet. You may try it by simply creating a file in MS Excel and password protect it and then open it using the Open Office and it will allow to open it with out prompting for a password. This issue is not with Aspose APIs but with Open Office.
If you are not using the Open Office, please provide us with the complete details about your system environment and Ms Excel version you are using and we will check it soon.
Thank You & Best Regards,
hello
thanks for ur consideration ok i will check this .i will come back to u . if any one using open office can open it then how can i protect it.is there any other option like can i disable the tools -->protect sheet ---->sheet option like that plz send me.
hello <br><br> thanks for ur consideration ok i will
check this .i will come back to u . if any one using open office can
open it then how can i protect it.is there any other option like can i
disable the tools -->protect sheet ---->sheet option like that
plz send me.