WorkbookSettings.ProtectionType
WorkbookSettings.ProtectionType property
Gets the protection type of the workbook.
public ProtectionType ProtectionType { get; }
Examples
using System;
using Aspose.Cells;
namespace AsposeCellsExamples
{
public class WorkbookSettingsPropertyProtectionTypeDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
// Protect the workbook with Windows protection type
workbook.Protect(ProtectionType.Windows, "password123");
// Demonstrate ProtectionType property
Console.WriteLine("Workbook protection type: " + workbook.Settings.ProtectionType);
// Save the workbook
workbook.Save("ProtectedWorkbook.xlsx");
// Load the saved workbook to verify protection type persists
Workbook loadedWorkbook = new Workbook("ProtectedWorkbook.xlsx");
Console.WriteLine("Loaded workbook protection type: " + loadedWorkbook.Settings.ProtectionType);
}
}
}
See Also
- enum ProtectionType
- class WorkbookSettings
- namespace Aspose.Cells
- assembly Aspose.Cells