如何设置工作簿的自动恢复属性

下面的代码解释了如何使用工作簿.设置.自动恢复工作簿的属性。代码首先读取此属性的默认值,即真的,然后将其设置为错误的并保存工作簿。然后它再次读取工作簿并读取此属性的值错误的此时。

C# 设置工作簿自动恢复属性的代码

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// 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);

输出

这是上述示例代码的控制台输出。

AutoRecover: True

AutoRecover: False