org.apache.poi
Class POIXMLProperties

java.lang.Object
  extended by org.apache.poi.POIXMLProperties

public class POIXMLProperties
extends java.lang.Object

Wrapper around the three different kinds of OOXML properties and metadata a document can have (Core, Extended and Custom), as well Thumbnails.


Nested Class Summary
static class POIXMLProperties.CoreProperties
          The core document properties
static class POIXMLProperties.CustomProperties
          Custom document properties
static class POIXMLProperties.ExtendedProperties
          Extended document properties
 
Constructor Summary
POIXMLProperties(OPCPackage docPackage)
           
 
Method Summary
 void commit()
          Commit changes to the underlying OPC package
 POIXMLProperties.CoreProperties getCoreProperties()
          Returns the core document properties
 POIXMLProperties.CustomProperties getCustomProperties()
          Returns the custom document properties
 POIXMLProperties.ExtendedProperties getExtendedProperties()
          Returns the extended document properties
 java.lang.String getThumbnailFilename()
          Returns the name of the Document thumbnail, eg thumbnail.jpeg, or null if there isn't one.
 java.io.InputStream getThumbnailImage()
          Returns the Document thumbnail image data, or null if there isn't one.
protected  PackagePart getThumbnailPart()
          Returns the PackagePart for the Document Thumbnail, or null if there isn't one
 void setThumbnail(java.lang.String filename, java.io.InputStream imageData)
          Sets the Thumbnail for the document, replacing any existing one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POIXMLProperties

public POIXMLProperties(OPCPackage docPackage)
                 throws java.io.IOException,
                        OpenXML4JException,
                        org.apache.xmlbeans.XmlException
Throws:
java.io.IOException
OpenXML4JException
org.apache.xmlbeans.XmlException
Method Detail

getCoreProperties

public POIXMLProperties.CoreProperties getCoreProperties()
Returns the core document properties

Returns:
the core document properties

getExtendedProperties

public POIXMLProperties.ExtendedProperties getExtendedProperties()
Returns the extended document properties

Returns:
the extended document properties

getCustomProperties

public POIXMLProperties.CustomProperties getCustomProperties()
Returns the custom document properties

Returns:
the custom document properties

getThumbnailPart

protected PackagePart getThumbnailPart()
Returns the PackagePart for the Document Thumbnail, or null if there isn't one

Returns:
The Document Thumbnail part or null

getThumbnailFilename

public java.lang.String getThumbnailFilename()
Returns the name of the Document thumbnail, eg thumbnail.jpeg, or null if there isn't one.

Returns:
The thumbnail filename, or null

getThumbnailImage

public java.io.InputStream getThumbnailImage()
                                      throws java.io.IOException
Returns the Document thumbnail image data, or null if there isn't one.

Returns:
The thumbnail data, or null
Throws:
java.io.IOException - if the thumbnail can't be read

setThumbnail

public void setThumbnail(java.lang.String filename,
                         java.io.InputStream imageData)
                  throws java.io.IOException
Sets the Thumbnail for the document, replacing any existing one.

Parameters:
filename - The filename for the thumbnail image, eg thumbnail.jpg
imageData - The inputstream to read the thumbnail image from
Throws:
java.io.IOException - if the thumbnail can't be written

commit

public void commit()
            throws java.io.IOException
Commit changes to the underlying OPC package

Throws:
java.io.IOException - if the properties can't be saved
POIXMLException - if the properties are erroneous


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