This project is read-only.

HOW TO: Protect Workbooks

Jan 12, 2010 at 6:20 AM
Edited Jan 12, 2010 at 6:44 AM


Does anyone have a idea how to protect the structure of a workbook using NPOI. I do not want to allow users to un-hide some of the protected sheets within the generated Excel file. I know that you can do it using the Excel Libraries by using the following technique:

I am aware of the workbook.WriteProtectWorkbook("password"); method, but only sets a password on the entire document. Thus when you open the workbook you need to type in a password or open it as read-only. But in all this you are still allowed to un-hide protected sheets

Any help would be greatly appreciated.



Jan 14, 2010 at 12:00 PM

Is this what you want?

Jan 14, 2010 at 3:01 PM

Hi Tony,

Yes the section that details the following

"Protecting the structure and windows of a workbook

You can lock the structure of a workbook, which prevents users from adding or deleting worksheets or from displaying hidden worksheets. You can also prevent users from changing the size or position of worksheet windows. Workbook structure and window protection applies to the whole workbook."

from the following link