Class XSLFSheet

    • Constructor Detail

      • XSLFSheet

        protected XSLFSheet()
      • XSLFSheet

        protected XSLFSheet​(PackagePart part)
        Since:
        POI 3.14-Beta1
    • Method Detail

      • allocateShapeId

        protected int allocateShapeId()
      • registerShapeId

        protected void registerShapeId​(int shapeId)
      • deregisterShapeId

        protected void deregisterShapeId​(int shapeId)
      • buildShapes

        protected static java.util.List<XSLFShape> buildShapes​(org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape spTree,
                                                               XSLFShapeContainer parent)
      • getXmlObject

        public abstract org.apache.xmlbeans.XmlObject getXmlObject()
        Returns:
        top-level Xml bean representing this sheet
      • createTable

        public XSLFTable createTable()
      • iterator

        public java.util.Iterator<XSLFShape> iterator()
        Returns an iterator over the shapes in this sheet
        Specified by:
        iterator in interface java.lang.Iterable<XSLFShape>
        Returns:
        an iterator over the shapes in this sheet
      • removeShape

        public boolean removeShape​(XSLFShape xShape)
        Removes the specified shape from this sheet, if it is present (optional operation). If this sheet does not contain the element, it is unchanged.
        Specified by:
        removeShape in interface ShapeContainer<XSLFShape,​XSLFTextParagraph>
        Parameters:
        xShape - shape to be removed from this sheet, if present
        Returns:
        true if this sheet contained the specified element
        Throws:
        java.lang.IllegalArgumentException - if the type of the specified shape is incompatible with this sheet (optional)
      • clear

        public void clear()
        Removes all of the elements from this container (optional operation). The container will be empty after this call returns.
        Specified by:
        clear in interface XSLFShapeContainer
      • getRootElementName

        protected abstract java.lang.String getRootElementName()
      • getSpTree

        protected org.openxmlformats.schemas.presentationml.x2006.main.CTGroupShape getSpTree()
      • commit

        protected final void commit()
                             throws java.io.IOException
        Description copied from class: POIXMLDocumentPart
        Save the content in the underlying package part. Default implementation is empty meaning that the package part is left unmodified.

        Sub-classes should override and add logic to marshal the "model" into Ooxml4J.

        For example, the code saving a generic XML entry may look as follows:

         protected void commit() throws IOException {
           PackagePart part = getPackagePart();
           OutputStream out = part.getOutputStream();
           XmlObject bean = getXmlBean(); //the "model" which holds changes in memory
           bean.save(out, DEFAULT_XML_OPTIONS);
           out.close();
         }
         
        Overrides:
        commit in class POIXMLDocumentPart
        Throws:
        java.io.IOException - a subclass may throw an IOException if the changes can't be committed
      • importContent

        public XSLFSheet importContent​(XSLFSheet src)
        Set the contents of this sheet to be a copy of the source sheet. This method erases any existing shapes and replaces them with object from the source sheet.
        Parameters:
        src - the source sheet to copy data from
        Returns:
        modified 'this'
      • appendContent

        public XSLFSheet appendContent​(XSLFSheet src)
        Append content to this sheet.
        Parameters:
        src - the source sheet
        Returns:
        modified this.
      • getTheme

        public XSLFTheme getTheme()
        Returns:
        theme (shared styles) associated with this theme. By default returns null which means that this sheet is theme-less. Sheets that support the notion of themes (slides, masters, layouts, etc.) should override this method and return the corresponding package part.
      • getPlaceholder

        public XSLFTextShape getPlaceholder​(int idx)
        Parameters:
        idx - 0-based index of a placeholder in the sheet
        Returns:
        placeholder
      • getPlaceholders

        public XSLFTextShape[] getPlaceholders()
        Returns:
        all placeholder shapes in this sheet
      • getFollowMasterGraphics

        public boolean getFollowMasterGraphics()
        Specified by:
        getFollowMasterGraphics in interface Sheet<XSLFShape,​XSLFTextParagraph>
        Returns:
        whether shapes on the master sheet should be shown. By default master graphics is turned off. Sheets that support the notion of master (slide, slideLayout) should override it and check this setting in the sheet XML
      • draw

        public void draw​(java.awt.Graphics2D graphics)
        Render this sheet into the supplied graphics object
        Specified by:
        draw in interface Sheet<XSLFShape,​XSLFTextParagraph>
        Parameters:
        graphics - the graphics context to draw to
      • getPlaceholderDetails

        public XSLFPlaceholderDetails getPlaceholderDetails​(Placeholder placeholder)
        Description copied from interface: Sheet
        Get the placeholder details for the given placeholder type. Not all placeholders are also shapes - this is especially true for old HSLF slideshows, which notes have header/footers elements which aren't shapes.
        Specified by:
        getPlaceholderDetails in interface Sheet<XSLFShape,​XSLFTextParagraph>
        Parameters:
        placeholder - the placeholder type
        Returns:
        the placeholder details or null, if the placeholder isn't contained in the sheet