将工作簿保存为严格的 Open XML 电子表格格式
Contents
[
Hide
]
可能的使用场景
Aspose.Cells 允许您将工作簿保存在严格的 Open XML 电子表格格式。为此,它提供了**工作簿.设置.合规性**财产。如果将其值设置为**OoxmlCompliance.Iso29500_2008_Strict**, 然后输出的 Excel 文件将以 Strict Open XML Spreadsheet 格式保存。
将工作簿保存为严格的 Open XML 电子表格格式
下面的示例代码创建一个工作簿并设置**工作簿.设置.合规性**财产作为**OoxmlCompliance.Iso29500_2008_Strict**并将其另存为输出Excel文件 .如果您在 Microsoft Excel 中打开输出 Excel 文件并打开“另存为…”对话框,您将看到其格式为*严格的 Open XML 电子表格*如这个屏幕截图所示。
示例代码
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 | |
// Create workbook. | |
Workbook wb = new Workbook(); | |
// Specify - Strict Open XML Spreadsheet - Format. | |
wb.Settings.Compliance = OoxmlCompliance.Iso29500_2008_Strict; | |
// Add message in cell B4 of first worksheet. | |
Cell b4 = wb.Worksheets[0].Cells["B4"]; | |
b4.PutValue("This Excel file has Strict Open XML Spreadsheet format."); | |
// Save to output Excel file. | |
wb.Save("outputSaveWorkbookToStrictOpenXMLSpreadsheetFormat.xlsx", SaveFormat.Xlsx); |