管理文档属性

可能的使用场景

Aspose.Cells 允许您使用内置和自定义文档属性。 这是打开这些 文档属性 的 Microsoft Excel 界面。 只需单击 高级属性,如此屏幕截图中所示,并查看它们。

todo:image_alt_text

管理文档属性

以下示例代码加载示例Excel文件,读取其内置文档属性(如标题和主题),并进行修改。还读取自定义文档属性(如MyCustom1),并添加新的自定义属性(MyCustom5),然后保存为输出Excel文件(23166986.xlsx)。截图展示了示例代码对样本Excel的效果。

todo:image_alt_text

示例代码

workbook, _ := NewWorkbook_String("23166989.xlsx")
docProperties, _ := workbook.GetBuiltInDocumentProperties()
title, _ := docProperties.GetTitle()
subject, _ := docProperties.GetSubject()
println(title, subject)
docProperties.SetTitle("Aspose.Cells New Title")
docProperties.SetSubject("Aspose.Cells New Subject")
customDocProperties, _ := workbook.GetCustomDocumentProperties()
myCustom1, _ := customDocProperties.Get_String("MyCustom1")
println(myCustom1)
customDocProperties.Add_String_String("MyCustom5", "This is my custom five.")
workbook.Save_String("67338369.pdf")

控制台输出

以上示例代码在执行时输出的控制台内容,使用提供的示例Excel文件

Title: Aspose Team

Subject: Aspose.Cells for Go via C++

MyCustom1: This is my custom one.