ドキュメントプロパティの管理
可能な使用シナリオ
Aspose.Cellsを使用すると、ビルトインおよびカスタムのドキュメントプロパティを操作できます。 ここにMicrosoft Excelインターフェースがあるので、これらのドキュメントプロパティを開くことが可能です。 このスクリーンショットに示されているように、詳細設定をクリックして表示できます。
ドキュメントプロパティの管理
以下のサンプルコードは、サンプルExcelファイルをロードし、組み込みのドキュメントプロパティ(例:TitleとSubject)を読み取り、それらを変更します。その後、カスタムドキュメントプロパティ(例:MyCustom1)を読み取り、新しいカスタムドキュメントプロパティ(例:MyCustom5)を追加し、結果のExcelファイルを保存します。コードの効果を示すスクリーンショットも併せて掲載しています。
サンプルコード
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.