Class DOCXDocument

    • Constructor Detail

      • DOCXDocument

        public DOCXDocument​(org.apache.poi.xwpf.usermodel.XWPFDocument xwpfDocument)
        Create a new Document by given XWPFDocument.
        Parameters:
        xwpfDocument - the XWPFDocument object.
    • Method Detail

      • getCT

        public org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocument1 getCT()
        Description copied from interface: ICTElement
        Returns the CT object of current element.
      • accept

        public java.lang.Object accept​(IDOCXVisitor visitor)
        Description copied from interface: IDOCXVisitable
        Accepts a visitor.
      • getXWPF

        public org.apache.poi.xwpf.usermodel.XWPFDocument getXWPF()
        Description copied from interface: IXWPFElement
        Returns the XWPF object of current element.
        Specified by:
        getXWPF in interface IXWPFElement
        Overrides:
        getXWPF in class AbstractBody
      • getParent

        public IXWPFElement getParent()
        Description copied from interface: IXWPFElement
        Returns the parent element of current element.
      • write

        public void write​(java.io.OutputStream os)
                   throws java.io.IOException
        Write the document to the given file output stream.
        Parameters:
        os - the OutputStream.
        Throws:
        java.io.IOException - if an I/O error occurs.
      • getSettings

        public DOCXSettings getSettings()
        Returns the settings of this document.

        Represents the xml file at word/settings.xml.

        Returns:
        the DOCXSettings object.
      • getSectPr

        public DOCXSectPr getSectPr()
        Returns the DOCXSectPr of this document (equals to the last section of the whole docx file).
        Returns:
        the DOCXSectPr object.
      • getSectPr

        public DOCXSectPr getSectPr​(boolean create)
        Returns the DOCXSectPr of this document (equals to the last section of the whole docx file).

        Represents the following element tag in the schema: w:sectPr.

        Parameters:
        create - whether to create a new section properties if not exist.
        Returns:
        the DOCXSectPr object.
      • getHeaderById

        public DOCXHdr getHeaderById​(java.lang.String id)
        Returns the DOCXHdr by the given id.
        Parameters:
        id - the header id.
        Returns:
        the DOCXHdr object.
      • getFooterById

        public DOCXFtr getFooterById​(java.lang.String id)
        Returns the DOCXFtr by the given id.
        Parameters:
        id - the footer id.
        Returns:
        the DOCXFtr object.