Managing Document Properties
Possible Usage Scenario
Aspose.Cells allows you to work with Built-In and Custom document properties. Here is the Microsoft Excel interface to open these Document Properties. Just click on the Advanced Properties as shown in this screenshot and view them.
Managing Document Properties
The following sample code loads sample Excel file and reads the built-in document properties, e.g., Title and Subject, and then changes them. Then, it also reads the custom document property, i.e., MyCustom1 and then adds a new custom document property, i.e., MyCustom5 and writes the output Excel file. The following screenshot shows the effect of the sample code on the sample Excel file.
Sample Code
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") |
Console Output
This is the console output of the above sample code when executed with the provided sample Excel file.
Title: Aspose Team
Subject: Aspose.Cells for Go via C++
MyCustom1: This is my custom one.