[]
        
(Showing Draft Content)

IDocumentProperty

Interface IDocumentProperty


public interface IDocumentProperty
Represents a custom or built-in document property.

An IDocumentProperty exposes workbook metadata such as the property name, value, type, and whether a custom property is linked to worksheet content. Custom properties can be created directly or linked to a named range so the property value reflects the referenced cell content.


 worksheet.getRange("A1").setValue("Hello");
 workbook.getNames().add("Headings", "=Sheet1!$A$1");
 IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Title", "Headings");
 Object value = property.getValue();
 
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the source of the linked content for this document property.
    boolean
    Gets whether this document property is linked to workbook content.
    Gets the name of the property.
    Gets the data type of the document property.
    Gets the value of the property.
    void
    Sets the value of the property.
  • Method Details

    • getName

      String getName()
      Gets the name of the property.

      Returns the name assigned to a built-in or custom document property.

      
       worksheet.getRange("A1").setValue("Hello");
       workbook.getNames().add("Headings", "=Sheet1!$A$1");
       IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Title", "Headings");
       String name = property.getName();
       
      Returns:
      The name of the property.
    • getValue

      Object getValue()
      Gets the value of the property.

      Returns the current value stored in this document property. For a property created by linking to content, the returned value reflects the linked content value.

      
       worksheet.getRange("A1").setValue("Hello");
       workbook.getNames().add("Headings", "=Sheet1!$A$1");
       IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Title", "Headings");
       Object value = property.getValue();
       
      Returns:
      The value of the property.
    • setValue

      void setValue(Object value)
      Sets the value of the property.

      Sets the current value stored in this document property. For a property created by linking to content, the value being set becomes the current property value.

      
       IDocumentProperty property = workbook.getCustomDocumentProperties().add("Name", "Headings");
       property.setValue(100);
       
      Parameters:
      value - The value of the property.
    • getLinkToContent

      boolean getLinkToContent()
      Gets whether this document property is linked to workbook content.

      A linked document property is typically created by ICustomDocumentPropertyCollection.addLinkToContent(String,String) and uses a named range as its content source.

      
       worksheet.getRange("A1").setValue("Hello");
       workbook.getNames().add("Headings", "=Sheet1!$A$1");
       IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Title", "Headings");
       boolean linkToContent = property.getLinkToContent();
       
      Returns:
      true if this property is linked to workbook content; otherwise, false.
    • getLinkSource

      String getLinkSource()
      Gets the source of the linked content for this document property.

      For a property created by ICustomDocumentPropertyCollection.addLinkToContent(String,String), the returned string identifies the named range used as the content source.

      
       worksheet.getRange("A1").setValue("Hello");
       workbook.getNames().add("Headings", "=Sheet1!$A$1");
       IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Title", "Headings");
       String source = property.getLinkSource();
       
      Returns:
      The linked content source.
    • getType

      PropertyType getType()
      Gets the data type of the document property.

      Use this method to determine which PropertyType is associated with the current built-in or custom document property.

      
       worksheet.getRange("A1").setValue("Hello");
       workbook.getNames().add("Headings", "=Sheet1!$A$1");
       IDocumentProperty property = workbook.getCustomDocumentProperties().addLinkToContent("Title", "Headings");
       PropertyType type = property.getType();
       
      Returns:
      The PropertyType of the document property.