[]
        
(Showing Draft Content)

IDocumentPropertyCollection

Interface IDocumentPropertyCollection

All Known Subinterfaces:
IBuiltInDocumentPropertyCollection, ICustomDocumentPropertyCollection

public interface IDocumentPropertyCollection
Represents a collection of document properties.

This interface provides access to built-in and custom document properties in a workbook. Use it to retrieve properties by name or index, check whether a property exists, get the number of properties, or remove properties from the collection.


 ICustomDocumentPropertyCollection customProperties = workbook.getCustomDocumentProperties();
 customProperties.add("Department", "Sales");
 IDocumentPropertyCollection properties = customProperties;
 IDocumentProperty property = properties.get("Department");
 
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all properties from the collection.
    boolean
    Determines whether a document property with the specified name exists in this collection.
    get(int index)
    Gets the IDocumentProperty object at the specified index in the collection.
    get(String name)
    Returns the IDocumentProperty object with the specified name.
    int
    Gets the number of document properties in the collection.
    int
    Gets the index of a property by name.
    void
    remove(String name)
    Removes the property with the specified name from the collection.
    void
    removeAt(int index)
    Removes the property at the specified zero-based index.
  • Method Details

    • getCount

      int getCount()
      Gets the number of document properties in the collection.

      This method returns the current number of properties contained in this IDocumentPropertyCollection.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       properties.add("Region", "North");
       int count = properties.getCount();
       
      Returns:
      The number of document properties in the collection.
    • get

      Returns the IDocumentProperty object with the specified name.

      Use this method to retrieve a document property from the collection by its name.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       IDocumentProperty property = properties.get("Department");
       
      Parameters:
      name - The name of an element in the collection.
      Returns:
      The IDocumentProperty object with the specified name.
    • get

      IDocumentProperty get(int index)
      Gets the IDocumentProperty object at the specified index in the collection.

      Use this method to retrieve a document property by its position from an IDocumentPropertyCollection, such as a custom document property collection.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       IDocumentProperty property = properties.get(0);
       String name = property.getName();
       
      Parameters:
      index - The index of the document property in the collection.
      Returns:
      The IDocumentProperty object at the specified index.
    • contains

      boolean contains(String name)
      Determines whether a document property with the specified name exists in this collection.
      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       boolean contains = properties.contains("Department");
       
      Parameters:
      name - The name of the document property to look for.
      Returns:
      true if a document property with the specified name exists in this collection; otherwise, false.
    • clear

      void clear()
      Removes all properties from the collection.

      Use this method to empty a document property collection before adding a new set of properties.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       properties.add("Quarter", "Q2");
       properties.clear();
       
    • indexOf

      int indexOf(String name)
      Gets the index of a property by name.

      The property name comparison is case-insensitive.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       int index = properties.indexOf("department");
       
      Parameters:
      name - The case-insensitive name of the property.
      Returns:
      The zero-based index of the property. Returns a negative value if the property is not found.
    • remove

      void remove(String name)
      Removes the property with the specified name from the collection.

      The property name comparison is case-insensitive.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       properties.add("Region", "North");
       properties.remove("department");
       
      Parameters:
      name - The case-insensitive name of the property to remove.
    • removeAt

      void removeAt(int index)
      Removes the property at the specified zero-based index.

      Use this method to remove a document property by its position in the collection instead of by name.

      
       ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
       properties.add("Department", "Sales");
       properties.add("Region", "North");
       properties.removeAt(0);
       
      Parameters:
      index - The zero-based index of the property to remove.