Breaking News

Main Menu

Marco Paolini Ausmerzen Pdf To Excel

суббота 14 марта admin 89
Wednesday, 10 August 2011 02:48

Protect Excel Workbook and Worksheet in C#

Written by support iceblue

Search for jobs related to Excel spreadsheet food macronutrients or hire on the world's largest freelancing marketplace with 15m+ jobs. It's free to sign up and bid on jobs.

  • font sizedecrease font sizeincrease font size
Rate this item

One Excel workbook has several worksheets (default 3) so that users can choose to protect Excel workbook or specified worksheets in this workbook. Solutions in this guide focus on demonstrating how to protect Excel workbook and worksheet in C# and VB.NET with Spire.XLS for .NET.

Protect Workbook

Spire.XLS for .NET provides a Workbook.Protect(String) method of Workbook class to prevent other from opening Excel file without a correct password.

Effect as screenshot below:

Protect Worksheet

Workbook class contains a WorksheetCollection property to enable users to access specified worksheet. After accessing this worksheet, users can invoke Protect method of XlsWorksheetBase class to protect.

There are two possibilities to protect worksheet.

With Password: Pass String password to Protect worksheet to protect worksheet with a password. After protecting, users cannot do any actions on this worksheet.

With Password and Options: Pass String password and SheetProtectionType options to protect worksheet with password and specified permissions.

The following table presents 18 sheet protection types.

NoneRepresents none flags.
ObjectProtects shapes.
ScenariosProtects scenarios.
FormattingCellsAllows users to format any cells on a protected worksheet.
FormattingColumnsAllows users to format any columns on a protected worksheet.
FormattingRowsAllows users to format any rows on a protected worksheet.
InsertingColumnsAllows users to insert columns on a protected worksheet.
InsertingRowsAllows users to insert rows on a protected worksheet.
InsertingHyperlinksAllows users to insert hyperlinks on a protected worksheet.
DeletingColumnsAllows users to delete columns on a protected worksheet.
DeletingRowsAllows users to delete rows on a protected worksheet.
LockedCellsProtects locked cells.
SortingAllows users to sort on a protected worksheet.
FilteringAllows users to set filters on a protected worksheet.
UsingPivotTableAllows users to use pivot table reports on a protected worksheet.
UnlockedCellsProtects users interface, but not macros.
ContentsRepresents all flags.
AllRepresents default protection.

Code to protect worksheet with password:

for repositories and installers. Ubuntu 14+/Centos6+, 64-bit.Python: Versions 2.7, 3.6, 3.7, and 3.8.To use Navigator in, you must be able to reach these sites, so you may need to add them to a whitelist in your network’s firewall settings. Windows 8 or newer, 32-bit or 64-bit. for conda-forge and other channels on Anaconda Cloud (anaconda.org). macOS 10.13+, 64-bit. Install anaconda for mac docs.contiuum.

Effect as screenshot below:

Spire.XLS, specified designed for developers, enables to generate, write, edit and save Excel workbooks (Excel 97-2003, Excel 2007 and Excel 2010) in .NET, Silverlight and WPF with C# and VB.NET.

Additional Info

  • tutorial_title:Protect Excel Workbook and Worksheet
Last modified on Thursday, 10 July 2014 08:53
Read 6720 times
Published inSecurity
Tagged under
Social sharing

support iceblue

Latest from support iceblue

More in this category: « Easily Lock Excel Worksheet in C#, VB.NET Decrypt Excel Worksheet in C#, VB.NET »