EasyXLS

Protect Excel sheet

Concept

EasyXLS™ library enables you to protect and lock Excel cells and Excel sheet objects (images, charts, comments, etc.) in order to prevent editing or deleting the sheet elements.

The component also allows setting a sheet password for worksheets and chart sheets when protecting the Excel sheet elements. The password is optional. If set, the user cannot edit the sheet elements until the valid password is supplied.

EasyXLS also permits to protect formulas and hide formulas expressions.

Concept in action

The below example shows how to export data to Excel, protect Excel sheet and lock cells.

Source code sample

C#.NET
VB.NET
C++.NET
J#.NET
Java
PHP
ASP
C++
VB6
VBS
Coldfusion

The screen shot provides an example of an exported Excel file that has the sheet protected.

Protected Excel sheet

Locked cells

EasyXLS allows you to lock the Excel cells and prevent cell content and cell formatting to be edited using ExcelStyle.setLocked, ExcelCell.setLocked, ExcelColumn.setLocked and ExcelRow.setLocked methods.

Hidden formulas

EasyXLS allows you to hide the Excel formulas expressions using ExcelStyle.setHiddenFormula, ExcelCell.setHiddenFormula, ExcelColumn.setHiddenFormula and ExcelRow.setHiddenFormula methods.

Protect sheet with password

EasyXLS allows you to protect the sheet with an optional password using ExcelSheet.setProtectionPassword method.

Protect Excel sheet objects

EasyXLS automatically protects the Excel sheet objects like images, charts, comments and other objects when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowEditObjects method for worksheets or ExcelChartSheet.setProtectObjects for chart sheets.

Protect locked cells and unlocked cells selection

EasyXLS automatically allows the selection of cells when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowSelectLockedCells and ExcelWorksheet.setAllowSelectUnlockedCells methods.

Protect cells, rows and columns formatting

EasyXLS automatically do not allow to format cells, rows or columns when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowFormatCells, ExcelWorksheet.setAllowFormatRows or ExcelWorksheet.setAllowFormatColumns methods.

Protect rows and columns insertion

EasyXLS automatically do not allow to insert rows or columns when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowInsertColumns or ExcelWorksheet.setAllowInsertRows methods.

Protect hyperlink insertion

EasyXLS automatically do not allow to insert hyperlinks when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowInsertHyperlinks method.

Protect rows and columns deletion

EasyXLS automatically do not allow to delete rows or columns when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowDeleteColumns or ExcelWorksheet.setAllowDeleteRows methods.

Protect sort and autofilter usage

EasyXLS automatically do not allow sorting and filtering worksheet data when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowSort or ExcelWorksheet.setAllowUseAutofilter methods.

Protect pivot table and pivot chart usage

EasyXLS automatically do not allow to use pivot tables or pivot charts when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowUsePivots method.

Protect worksheet scenarios

EasyXLS automatically protects the Excel worksheet scenarios when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelWorksheet.setAllowEditScenarios method.

Protect chart sheet content

EasyXLS automatically protects the content of the chart sheet when the sheet is protected using ExcelSheet.setSheetProtected method.

In order to change this behavior use ExcelChartSheet.setProtectContents method.

Getting started with EasyXLS Excel library

To download the trial version of EasyXLS Excel Library, press the below button:

Download EasyXLS™ Excel Library for .NET and Java

If you already own a license key, you may login and download EasyXLS from your account.



Available for: Professional, Excel Writer, Excel Reader
Go to top

EasyXLS Excel libraries:

.NET
.NET Excel Library
full .NET version to import, export or convert Excel files
.NET Excel Writer
.NET version to create and export Excel files
.NET Excel Reader
.NET version to read and import Excel files
-
Java
Java Excel Library
full Java version to import, export or convert Excel files
Java Excel Writer
Java version to create and export Excel files
Java Excel Reader
Java version to read and import Excel files
Download EasyXLS™ Excel Library for .NET and Java

File formats:

MS Excel 97 - 2003
MS Excel 2007 - 2010
MS Excel 2013
MS Excel 2016
MS Excel 2019
XLSX XLSM XLSB XLS
XML HTML CSV TXT