Class CustomPropertyCollection

CustomPropertyCollection class

A collection of CustomProperty objects that represent additional information.

public class CustomPropertyCollection : CollectionBase<CustomProperty>

Properties

NameDescription
Capacity { get; set; }
Count { get; }
Item { get; }Gets the custom property by the specific index. (2 indexers)
Item { get; set; }

Methods

NameDescription
Add(string, string)Adds custom property information.
BinarySearch(CustomProperty)
BinarySearch(CustomProperty, IComparer<CustomProperty>)
BinarySearch(int, int, CustomProperty, IComparer<CustomProperty>)
Clear()
Contains(CustomProperty)
CopyTo(CustomProperty[])
CopyTo(CustomProperty[], int)
CopyTo(int, CustomProperty[], int, int)
Exists(Predicate<CustomProperty>)
Find(Predicate<CustomProperty>)
FindAll(Predicate<CustomProperty>)
FindIndex(Predicate<CustomProperty>)
FindIndex(int, Predicate<CustomProperty>)
FindIndex(int, int, Predicate<CustomProperty>)
FindLast(Predicate<CustomProperty>)
FindLastIndex(Predicate<CustomProperty>)
FindLastIndex(int, Predicate<CustomProperty>)
FindLastIndex(int, int, Predicate<CustomProperty>)
GetEnumerator()
IndexOf(CustomProperty)
IndexOf(CustomProperty, int)
IndexOf(CustomProperty, int, int)
LastIndexOf(CustomProperty)
LastIndexOf(CustomProperty, int)
LastIndexOf(CustomProperty, int, int)
RemoveAt(int)

Examples

[C#]

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

    public class CustomPropertyCollectionDemo
    {
        public static void CustomPropertyCollectionExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Access the CustomPropertyCollection of the worksheet
            CustomPropertyCollection customProperties = worksheet.CustomProperties;

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

            // Access and print the 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("CustomPropertyCollectionExample.xlsx");
            workbook.Save("CustomPropertyCollectionExample.pdf");
            return;
        }
    }
}

See Also