org.apache.poi.ooxml

## Class POIXMLProperties.CustomProperties

- java.lang.Object
- - org.apache.poi.ooxml.POIXMLProperties.CustomProperties

- Enclosing class:
    POIXMLProperties

      public static class POIXMLProperties.CustomProperties
      extends java.lang.Object

  Custom document properties

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `FORMAT_ID` Each custom property element contains an fmtid attribute with the same GUID value ({D5CDD505-2E9C-101B-9397-08002B2CF9AE}).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addProperty(java.lang.String name, boolean value)` Add a new boolean property
    `void` | `addProperty(java.lang.String name, double value)` Add a new double property
    `void` | `addProperty(java.lang.String name, int value)` Add a new integer property
    `void` | `addProperty(java.lang.String name, java.lang.String value)` Add a new string property
    `boolean` | `contains(java.lang.String name)` Check if a property with this name already exists in the collection of custom properties
    `protected int` | `getLastPid()` Find the highest Pid in use
    `org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty` | `getProperty(java.lang.String name)` Retrieve the custom property with this name, or null if none exists.
    `org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties` | `getUnderlyingProperties()`
    `protected int` | `nextPid()` Generate next id that uniquely relates a custom property

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### FORMAT_ID

          public static final java.lang.String FORMAT_ID

      Each custom property element contains an fmtid attribute with the same GUID value ({D5CDD505-2E9C-101B-9397-08002B2CF9AE}).
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getUnderlyingProperties

          public org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperties getUnderlyingProperties()

    - #### addProperty

          public void addProperty(java.lang.String name,
                                  java.lang.String value)

      Add a new string property
      Parameters:
        `name` - the property name
        `value` - the property value
      Throws:
        `java.lang.IllegalArgumentException` - if a property with this name already exists

    - #### addProperty

          public void addProperty(java.lang.String name,
                                  double value)

      Add a new double property
      Parameters:
        `name` - the property name
        `value` - the property value
      Throws:
        `java.lang.IllegalArgumentException` - if a property with this name already exists

    - #### addProperty

          public void addProperty(java.lang.String name,
                                  int value)

      Add a new integer property
      Parameters:
        `name` - the property name
        `value` - the property value
      Throws:
        `java.lang.IllegalArgumentException` - if a property with this name already exists

    - #### addProperty

          public void addProperty(java.lang.String name,
                                  boolean value)

      Add a new boolean property
      Parameters:
        `name` - the property name
        `value` - the property value
      Throws:
        `java.lang.IllegalArgumentException` - if a property with this name already exists

    - #### nextPid

          protected int nextPid()

      Generate next id that uniquely relates a custom property
      Returns:
        next property id starting with 2

    - #### getLastPid

          protected int getLastPid()

      Find the highest Pid in use
      Returns:
        the highest Pid in use in the property set; returns 1 if no properties are set

    - #### contains

          public boolean contains(java.lang.String name)

      Check if a property with this name already exists in the collection of custom properties
      Parameters:
        `name` - the name to check
      Returns:
        whether a property with the given name exists in the custom properties

    - #### getProperty

          public org.openxmlformats.schemas.officeDocument.x2006.customProperties.CTProperty getProperty(java.lang.String name)

      Retrieve the custom property with this name, or null if none exists. You will need to test the various isSetX methods to work out what the type of the property is, before fetching the appropriate value for it.
      Parameters:
        `name` - the name of the property to fetch
      Returns:
        the custom property with this name, or null if none exists

Copyright 2020 The Apache Software Foundation or its licensors, as applicable.