Class CustomProperty

CustomProperty class

Represents identifier information.

public class CustomProperty

Constructors

NameDescription
CustomProperty()The default constructor.

Properties

NameDescription
Name { get; set; }Returns or sets the name of the object.
StringValue { get; set; }(Obsolete.) Returns or sets the value of the custom property.
Value { get; set; }Returns or sets the value of the custom property.

Examples

[C#]

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

    public class CustomPropertyDemo
    {
        public static void CustomPropertyExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet sheet = workbook.Worksheets[0];

            // Access the CustomProperties collection
            CustomPropertyCollection customProperties = sheet.CustomProperties;

            // Add custom properties
            customProperties.Add("Author", "John Doe");
            customProperties.Add("Version", "1.0");
            customProperties.Add("LastModified", DateTime.Now.ToString());

            // Access and display custom properties
            for (int i = 0; i < customProperties.Count; i++)
            {
                CustomProperty property = customProperties[i];
                Console.WriteLine($"Name: {property.Name}, Value: {property.Value}");
            }

            // Save the workbook
            workbook.Save("CustomPropertyExample.xlsx");
            workbook.Save("CustomPropertyExample.pdf");
        }
    }
}

See Also