在 Excel 中禁用兼容性检查器
Contents
[
Hide
]
在 C# 中禁用 Excel 工作表中的兼容性检查器
Microsoft 以早期文件格式保存文件时,Excel 的兼容性检查器标记可能会导致功能问题或保真度丢失。兼容性检查器是 Microsoft Office Excel 2007 和 Microsoft Excel 2010 的一项功能。
当您从 Excel 2007 或 Excel 2010 将工作簿保存为早期版本(从 Excel 97 到 Excel 2003)时,兼容性检查器会扫描工作簿以查看它是否包含早期版本不支持的功能。为了帮助您决定如何处理兼容性问题,兼容性检查器会显示带有选项的对话框。它还可用于创建有关工作簿中任何问题的报告,或禁用该功能。
有时,您需要禁用特定电子表格的兼容性检查器。使用 Aspose.Cells' API,您可以以编程方式执行此操作,这样用户在手动将文件重新保存到 Microsoft Excel 中时,不会因弹出的兼容性检查器对话框而感到沮丧或困惑。
使用 Microsoft Excel
要禁用 Microsoft Excel 中的兼容性检查器(例如 Microsoft Excel 2007/2010):
- (Excel 2007) 在 Office 按钮上,单击准备, 然后运行兼容性检查器,然后清除保存此工作簿时检查兼容性选项。
- (Excel 2010) 在“文件”选项卡上,单击信息, 然后检查问题 , 点击检查兼容性,最后,清除保存此工作簿时检查兼容性选项。
使用 Aspose.Cells API
设置工作簿.设置.检查兼容性财产给错误的禁用 Microsoft Excel 的兼容性检查器。
代码示例
下面的代码示例显示了如何使用 Aspose.Cells for .NET 禁用兼容性检查器。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
// Open a template file | |
Workbook workbook = new Workbook(dataDir+ "sample.xlsx"); | |
// Disable the compatibility checker | |
workbook.Settings.CheckCompatibility = false; | |
dataDir = dataDir + "Output_BK_CompCheck.out.xlsx"; | |
// Saving the Excel file | |
workbook.Save(dataDir); |