在 Excel 中禁用兼容性检查器
Contents
[
Hide
]
Microsoft 以较早的文件格式保存文件时,Excel 的兼容性检查器会标记保存文件可能会导致功能问题或保真度丢失。兼容性检查器是 Microsoft Office Excel 2007、2010 和 2013 的一项功能。
当您从 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 和 2013)在文件选项卡上,单击信息, 然后检查问题 , 点击检查兼容性,最后,清除保存此工作簿时检查兼容性选项。
使用 Aspose.Cells API
设置工作簿设置.检查兼容性财产给错误的禁用 Microsoft Excel 的兼容性检查器。
假设我们有一个模板文件 XLS。当用户在 MS Excel 2007/2010/2013 中保存或重新保存它时,将显示兼容性检查器对话框,如下面的屏幕截图所示。
以下代码显示了如何使用 Aspose.Cells for Java 禁用兼容性检查器。
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-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(DisableCompatibilityChecker.class); | |
// Open a template file | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Disable the compatibility checker | |
workbook.getSettings().setCheckCompatibility(false); | |
// Saving the Excel file | |
workbook.save(dataDir + "outCompCheck.xls"); |