Aspose.Cells.Examples.CSharp.Worksheets.Security.Unprotect.UnprotectingSimplyProtectedWorksheet.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Instantiating a Workbook object
            Workbook workbook = new Workbook(dataDir + "book1.xls");

            // Accessing the first worksheet in the Excel file
            Worksheet worksheet = workbook.Worksheets[0];
            
            // Unprotecting the worksheet without a password
            worksheet.Unprotect();

            // Saving the Workbook
            workbook.Save(dataDir + "output.xls", SaveFormat.Excel97To2003);
            // ExEnd:1


        }
    }
UnprotectingSimplyProtectedWorksheet