[]
        
(Showing Draft Content)

ICustomDocumentPropertyCollection

Interface ICustomDocumentPropertyCollection

All Superinterfaces:
IDocumentPropertyCollection

public interface ICustomDocumentPropertyCollection extends IDocumentPropertyCollection
A collection of custom document properties.

Represents the custom metadata stored in a workbook. Use this collection to add, remove, and access application-defined document properties such as text, numeric, Boolean, date, and linked-content properties.


 ICustomDocumentPropertyCollection properties = workbook.getCustomDocumentProperties();
 properties.add("Department", "Sales");
 properties.add("Revision", 3);
 String fileName = "CustomDocumentProperties.xlsx";
 workbook.save(fileName);
 
  • Method Details

    • add

      IDocumentProperty add(String name, String value)
      Creates a new IDocumentProperty with a string value and adds it to the custom document properties available for the current Workbook.
      
       IDocumentProperty property = workbook.getCustomDocumentProperties().add("Department", "Sales");
       
      Parameters:
      name - The name of the new IDocumentProperty.
      value - The string value of the property.
      Returns:
      The new IDocumentProperty.
    • add

      IDocumentProperty add(String name, int value)
      Creates a new custom document property with an integer value and adds it to the current Workbook.

      The new property is added to the collection returned by Workbook.getCustomDocumentProperties().

      
       IDocumentProperty property = workbook.getCustomDocumentProperties().add("Revision", 3);
       Object value = property.getValue();
       
      Parameters:
      name - The name of the new IDocumentProperty.
      value - The integer value of the property.
      Returns:
      The new IDocumentProperty.
    • add

      IDocumentProperty add(String name, Calendar value)
      Creates a new IDocumentProperty with a date value and adds it to the custom document properties available for the current Workbook.
      
       Calendar publishedOn = Calendar.getInstance();
       publishedOn.set(2024, Calendar.JANUARY, 15, 0, 0, 0);
       publishedOn.set(Calendar.MILLISECOND, 0);
       IDocumentProperty property = workbook.getCustomDocumentProperties().add("PublishedOn", publishedOn);
       PropertyType type = property.getType();
       
      Parameters:
      name - The name of the new IDocumentProperty.
      value - The date value of the property.
      Returns:
      The new IDocumentProperty.
    • add

      IDocumentProperty add(String name, boolean value)
      Creates a new IDocumentProperty with a Boolean value and adds the property to the custom document properties available for the current Workbook.
      
       IDocumentProperty property = workbook.getCustomDocumentProperties().add("IsReviewed", true);
       
      Parameters:
      name - The name of the new IDocumentProperty.
      value - The Boolean value of the property.
      Returns:
      The new IDocumentProperty.
    • add

      IDocumentProperty add(String name, double value)
      Creates a new IDocumentProperty with a double-precision floating-point value and adds it to the custom document properties of the current Workbook.
      
       IDocumentProperty property = workbook.getCustomDocumentProperties().add("Price", 19.95);
       PropertyType type = property.getType();
       
      Parameters:
      name - The new IDocumentProperty name.
      value - The double value of the property.
      Returns:
      The new IDocumentProperty.
    • addLinkToContent

      IDocumentProperty addLinkToContent(String name, String source)
      Creates a new IDocumentProperty that is linked to workbook content and adds it to the custom document properties of the current Workbook.

      The source argument specifies a workbook defined name, such as a named range. If the defined name refers to multiple cells, the property uses the value of the top-left cell.

      
       worksheet.getRange("A1").setValue("Sales");
       workbook.getNames().add("DepartmentCell", "=Sheet1!$A$1");
       IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Department", "DepartmentCell");
       String linkSource = property.getLinkSource();
       
      Parameters:
      name - The name of the new IDocumentProperty.
      source - The workbook defined name, such as a named range, whose referenced content is linked to the property.
      Returns:
      The new IDocumentProperty.