文書情報パネル内で表示されるカスタムプロパティを追加する
Contents
[
Hide
]
ドキュメント情報パネルで表示されるカスタムプロパティの追加
Aspose.Cellsを使用すると、ワークブックオブジェクト内に文書情報パネルで表示されるカスタムプロパティを追加できます。Microsoft Excelで文書情報パネルを開くには、ファイル > 情報 > プロパティ > ドキュメントパネルを選択します。
文書情報パネルで表示されるカスタムプロパティを追加するには、Workbook.ContentTypeProperties.Add() メソッドを使用してください
次のサンプルコードでは、2つのカスタムプロパティを追加します。1つ目のプロパティにはタイプがなく、2つ目のプロパティにはDateTime型が指定されています。このコードで生成された出力Excelファイルを開くと、これらの2つのプロパティが文書情報パネル内に表示されます。
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"); |