Click or drag to resize

XlsWorksheetBase Protect Method (String)

Protects worksheet with password.protect the sheet except select lock/unlock cells.
Examples
The following code illustrates how to protect the sheet except select lock/unlock cells:
<para>//Create worksheet</para><para>Workbook workbook = new Workbook();</para><para>Worksheet worksheet = workbook.Worksheets[0];</para><para>//Protects the first worksheet's content with password</para><para>worksheet.Protect("123456");</para><para>//Save to file</para><para>workbook.SaveToFile("Protect.xlsx");</para>

Namespace: Spire.Xls.Core.Spreadsheet
Assembly: Spire.XLS (in Spire.XLS.dll) Version: 15.4.0.0 (15.4.0.5046)
Syntax
public void Protect(
	string password
)

Parameters

password
Type: System String
Protection password.

Implements

ITabSheet Protect(String)
Remarks
Password should be less than 15 symbols.
See Also