Enum MetadataType

MetadataType enumeration

Represents the type of metadata.

[Flags]
public enum MetadataType

Values

NameValueDescription
Encryption1Encrypts the file.
Decryption2Decrypts the file.
DocumentProperties4Load the properties of the file.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells.Metadata;
    using Aspose.Cells.Properties;
    using System;
    using System.IO;

    public class MetadataTypeDemo
    {
        public static void MetadataTypeExample()
        {
            // Define the file path
            string filePath = "MetadataTypeExample_original.xlsx";

            // Create MetadataOptions for DocumentProperties
            MetadataOptions options = new MetadataOptions(MetadataType.DocumentProperties);

            // Load the workbook metadata
            WorkbookMetadata metadata = new WorkbookMetadata(filePath, options);

            // Access built-in document properties
            BuiltInDocumentPropertyCollection builtInProperties = metadata.BuiltInDocumentProperties;

            // Access custom document properties
            CustomDocumentPropertyCollection customProperties = metadata.CustomDocumentProperties;

            // Display some built-in properties
            Console.WriteLine("Title: " + builtInProperties["Title"]);
            Console.WriteLine("Author: " + builtInProperties["Author"]);
            Console.WriteLine("Company: " + builtInProperties["Company"]);

            // Add a custom property
            customProperties.Add("MyCustomProperty", "CustomValue");

            // save to a different file
            string newFilePath = "MetadataTypeExample.xlsx";
            metadata.Save(newFilePath);

            Console.WriteLine("Metadata updated and saved successfully.");
        }
    }
}

See Also