Lock a cell in a worksheet

Mar 10, 2010 at 9:38 AM
Edited Mar 10, 2010 at 9:39 AM

Can I lock  a cell (or  make a cell readable only) in a worksheet by using EPPlus?  THX!

Coordinator
Mar 10, 2010 at 9:52 AM

No, at least not today. There is no support for password protected workbooks/sheets, and for that reason i have not implemented the lock/hidden attribute for the styles.

Coordinator
Mar 10, 2010 at 11:24 AM

Your could try to use a template where you have protected the sheet (I have not tried it myself). You cant change the lock property of the cells from within the component, but if that's ok with you its worth a try.

Mar 11, 2010 at 1:41 AM
Edited Mar 11, 2010 at 1:42 AM

Thank for your quick reply! It can read  a protected worksheet! How can I change the lock property of the cells within the component? THX!

 

Coordinator
Mar 11, 2010 at 11:41 AM

You can NOT change the lock property in the current version, so setting sheet protection in a template will proberbly make the whole sheet readonly (if it works at all, I have not tried it).

I think it should be quite easy to implement a lock property (to the ExcelStyle & ExcelXfs class), so I can have a look at it to the next version.

Coordinator
Mar 16, 2010 at 8:34 AM

I have added sheetprotection in the new source, so try it out. You can lock/unlock cells with the Style.Locked property.

Mar 25, 2010 at 2:21 AM

THANK YOU VERY MUCH!!! I have struggled with the mud pit of the open XML SDK 2.0 . Thank you for saving me!!