Is there any other way to protect worksheet without password

hi, for some reason, our team would like to protect a worksheet without using password.
the only way we could think of is transferring entire sheet to image and insert it back. However, transfer entire sheet to image might cause some performance issue.
Is there any other way you can suggest?

@catalparue,

You may try the following sample code to accomplish the task:
e.g.
Sample code:

Workbook workbook = new Workbook("Book1.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Protect(ProtectionType.All);
workbook.Save("e:\\test2\\\out1.xlsx");

Hope, this helps a bit.

hi, thanks for your response.
what does following function do?

worksheet.Protect(ProtectionType.All);

it will protect the worksheet with no password? If so, can user ‘unprotect’ this sheet?

@catalparue,

Yes, and the user can unprotect it in MS Excel by using Review|Unproect Sheet option in MS Excel manually. For Aspose.Cells to unprotect the sheet, he may use Worksheet.Unprotect() method in code.

hi, is there anyway user is not able to unprotect this sheet by using this function?

@catalparue,

No. That’s why it is always recommended to set password while protecting sheets or workbooks. In short, you got to protect the sheet with a password for safety.

understand! thank you. :slight_smile:

@catalparue,

You are welcome.