使用内置文档属性指定Excel文件的文档版本
Contents
[
Hide
]
可能的使用场景
您可以右键单击文件并选择属性 > 详细信息来更改Excel文件的版本号,然后编辑版本号字段。请使用 BuiltInDocumentPropertyCollection.DocumentVersion 属性使用Aspose.Cells API进行编程更改。
使用内置文档属性指定Excel文件的文档版本
以下示例代码创建一个工作簿并更改其中包括标题、作者和版本号的内置文档属性。请查看代码生成的输出Excel文件,以及显示由 BuiltInDocumentPropertyCollection.DocumentVersion 属性修改的版本号的截图。
示例代码
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 object | |
Workbook wb = new Workbook(); | |
//Access built-in document property collection | |
Aspose.Cells.Properties.BuiltInDocumentPropertyCollection bdpc = wb.BuiltInDocumentProperties; | |
//Set the title | |
bdpc.Title = "Aspose File Format APIs"; | |
//Set the author | |
bdpc.Author = "Aspose APIs Developers"; | |
//Set the document version | |
bdpc.DocumentVersion = "Aspose.Cells Version - 18.3"; | |
//Save the workbook in xlsx format | |
wb.Save("outputSpecifyDocumentVersionOfExcelFile.xlsx", SaveFormat.Xlsx); |