Workbook.Protect
Workbook.Protect method
Protects a workbook.
public void Protect(ProtectionType protectionType, string password)
| Parameter | Type | Description | 
|---|---|---|
| protectionType | ProtectionType | Protection type. | 
| password | String | Password to protect the workbook. | 
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
    public class WorkbookMethodProtectWithProtectionTypeStringDemo
    {
        public static void Run()
        {
            Workbook wbk = new Workbook();
            wbk.Protect(ProtectionType.Structure, "password123");
            
            wbk.Save("protected_workbook.xlsx", SaveFormat.Xlsx);
            wbk.Dispose();
        }
    }
}
See Also
- enum ProtectionType
 - class Workbook
 - namespace Aspose.Cells
 - assembly Aspose.Cells