在文档信息面板中显示添加的自定义属性
Contents
[
Hide
]
在文档信息面板中可见的自定义属性
Aspose.Cells可以用于向工作簿对象中添加可在文档信息面板中看到的自定义属性。您可以使用Microsoft Excel中的文件 > 信息 > 属性 > 显示文档面板菜单命令打开文档信息面板。
请使用 Workbook.ContentTypeProperties.Add() 方法添加可在文档信息面板中看到的自定义属性
以下示例代码添加了两个自定义属性。第一个属性没有任何类型,并且第二个属性是DateTime类型。一旦您打开此代码生成的输出Excel文件,您将在文档信息面板中看到这两个属性。
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); | |
// Create workbook object | |
Workbook workbook = new Workbook(FileFormatType.Xlsx); | |
// Add simple property without any type | |
workbook.ContentTypeProperties.Add("MK31", "Simple Data"); | |
// Add date time property with type | |
workbook.ContentTypeProperties.Add("MK32", "04-Mar-2015", "DateTime"); | |
// Save the workbook | |
workbook.Save(dataDir + "AddingCustomPropertiesVisible_out.xlsx"); |