Class WorkbookMetadata
Represents the meta data.
public class WorkbookMetadata
Constructors
Properties
Methods
Name | Description |
---|
Save(Stream) | Save the modified metadata to the stream. |
Save(string) | Save the modified metadata to the file. |
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Metadata;
using Aspose.Cells.Properties;
using System;
using System.IO;
public class WorkbookMetadataDemo
{
public static void WorkbookMetadataExample()
{
// Create MetadataOptions instance
MetadataOptions options = new MetadataOptions(MetadataType.DocumentProperties);
// Create WorkbookMetadata instance with a file name and options
WorkbookMetadata meta = new WorkbookMetadata("WorkbookMetadataExample_original.xlsx", options);
// Add a custom document property
meta.CustomDocumentProperties.Add("test", "test");
// Save the metadata to a new file
meta.Save("WorkbookMetadataExample.xlsx");
// Demonstrate accessing built-in document properties
BuiltInDocumentPropertyCollection builtInProps = meta.BuiltInDocumentProperties;
Console.WriteLine("Author: " + builtInProps.Author);
Console.WriteLine("Title: " + builtInProps.Title);
// Demonstrate accessing custom document properties
CustomDocumentPropertyCollection customProps = meta.CustomDocumentProperties;
foreach (DocumentProperty prop in customProps)
{
Console.WriteLine("Custom Property - Name: " + prop.Name + ", Value: " + prop.Value);
}
// Save the metadata to a stream
using (FileStream stream = new FileStream("WorkbookMetadataExample2.xlsx", FileMode.Create, FileAccess.Write))
{
meta.Save(stream);
}
}
}
}
See Also