Aspose.Cells.Examples.CSharp.Articles.ManagingWorkbooksWorksheets.SetAutoRecovery.Run C# (CSharp) Method

Run() public static method

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

            // Create workbook object
            Workbook workbook = new Workbook();

            // Read AutoRecover property
            Console.WriteLine("AutoRecover: " + workbook.Settings.AutoRecover);

            // Set AutoRecover property to false
            workbook.Settings.AutoRecover = false;

            // Save the workbook
            workbook.Save(dataDir + "output_out.xlsx");

            // Read the saved workbook again
            workbook = new Workbook(dataDir + "output_out.xlsx");

            // Read AutoRecover property
            Console.WriteLine("AutoRecover: " + workbook.Settings.AutoRecover);
            // ExEnd:SetAutoRecovery
        }
    }
SetAutoRecovery