Class POIXMLDocumentPart

    • Constructor Detail

      • POIXMLDocumentPart

        public POIXMLDocumentPart​(OPCPackage pkg)
        Construct POIXMLDocumentPart representing a "core document" package part.
        Parameters:
        pkg - the OPCPackage containing this document
      • POIXMLDocumentPart

        public POIXMLDocumentPart​(OPCPackage pkg,
                                  java.lang.String coreDocumentRel)
        Construct POIXMLDocumentPart representing a custom "core document" package part.
        Parameters:
        pkg - the OPCPackage containing this document
        coreDocumentRel - the relation type of this document
    • Method Detail

      • isCommited

        public boolean isCommited()
        to check whether embedded part is already committed
        Returns:
        return true if embedded part is committed
      • setCommited

        public void setCommited​(boolean isCommited)
        setter method to set embedded part is committed
        Parameters:
        isCommited - boolean value
      • getPackagePart

        public final PackagePart getPackagePart()
        Provides access to the underlying PackagePart
        Returns:
        the underlying PackagePart
      • getRelations

        public final java.util.List<POIXMLDocumentPart> getRelations()
        Returns the list of child relations for this POIXMLDocumentPart
        Returns:
        child relations
      • getRelationParts

        public final java.util.List<POIXMLDocumentPart.RelationPart> getRelationParts()
        Returns the list of child relations for this POIXMLDocumentPart
        Returns:
        child relations
      • addRelation

        public final POIXMLDocumentPart.RelationPart addRelation​(java.lang.String relId,
                                                                 POIXMLRelation relationshipType,
                                                                 POIXMLDocumentPart part)
        Add a new child POIXMLDocumentPart
        Parameters:
        relId - the preferred relation id, when null the next free relation id will be used
        relationshipType - the package relationship type
        part - the child to add
        Returns:
        the new RelationPart
        Since:
        3.14-Beta1
      • getParent

        public final POIXMLDocumentPart getParent()
        Returns the parent POIXMLDocumentPart. All parts except root have not-null parent.
        Returns:
        the parent POIXMLDocumentPart or null for the root element.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • createRelationship

        public final POIXMLDocumentPart createRelationship​(POIXMLRelation descriptor,
                                                           POIXMLFactory factory)
        Create a new child POIXMLDocumentPart
        Parameters:
        descriptor - the part descriptor
        factory - the factory that will create an instance of the requested relation
        Returns:
        the created child POIXMLDocumentPart
        Throws:
        PartAlreadyExistsException - If rule M1.12 is not verified : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names.
      • createRelationship

        public final POIXMLDocumentPart createRelationship​(POIXMLRelation descriptor,
                                                           POIXMLFactory factory,
                                                           int idx)
        Create a new child POIXMLDocumentPart
        Parameters:
        descriptor - the part descriptor
        factory - the factory that will create an instance of the requested relation
        idx - part number
        Returns:
        the created child POIXMLDocumentPart
        Throws:
        PartAlreadyExistsException - If rule M1.12 is not verified : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names.
      • createRelationship

        public final POIXMLDocumentPart.RelationPart createRelationship​(POIXMLRelation descriptor,
                                                                        POIXMLFactory factory,
                                                                        int idx,
                                                                        boolean noRelation)
        Create a new child POIXMLDocumentPart
        Parameters:
        descriptor - the part descriptor
        factory - the factory that will create an instance of the requested relation
        idx - part number
        noRelation - if true, then no relationship is added.
        Returns:
        the created child POIXMLDocumentPart
        Throws:
        PartAlreadyExistsException - If rule M1.12 is not verified : Packages shall not contain equivalent part names and package implementers shall neither create nor recognize packages with equivalent part names.
      • _invokeOnDocumentRead

        @Internal
        @Deprecated
        public static void _invokeOnDocumentRead​(POIXMLDocumentPart part)
                                          throws java.io.IOException
        Deprecated.
        Internal method, do not use!

        This method only exists to allow access to protected onDocumentRead() from XWPFDocument without reflection. It should be removed.

        Parameters:
        part - the part which is to be read
        Throws:
        java.io.IOException - if the part can't be read