Class WordprocessingMLPackage

java.lang.Object
org.docx4j.openpackaging.Base
org.docx4j.openpackaging.packages.OpcPackage
org.docx4j.openpackaging.packages.WordprocessingMLPackage
All Implemented Interfaces:
PackageIdentifier
Direct Known Subclasses:
WordprocessingMLTemplatePackage

public class WordprocessingMLPackage
extends OpcPackage
Author:
jharrop
  • Field Details

  • Constructor Details

  • Method Details

    • getProtectionSettings

      public ProtectDocument getProtectionSettings()
    • getDocumentModel

      public DocumentModel getDocumentModel()
    • getHeaderFooterPolicy

      @Deprecated public HeaderFooterPolicy getHeaderFooterPolicy()
      Deprecated.
    • load

      public static WordprocessingMLPackage load​(java.io.File docxFile) throws Docx4JException
      Convenience method to create a WordprocessingMLPackage from an existing File (.docx zip or .xml Flat OPC).
      Parameters:
      docxFile - The docx file
      Throws:
      Docx4JException
    • load

      public static WordprocessingMLPackage load​(java.io.InputStream is) throws Docx4JException
      Convenience method to create a WordprocessingMLPackage from an existing stream(.docx zip or .xml Flat OPC).
      Parameters:
      docxFile - The docx file
      Throws:
      Docx4JException
    • setPartShortcut

      public boolean setPartShortcut​(Part part, java.lang.String relationshipType)
      Description copied from class: Base
      Tell the source Part about this target Part, so the source can use this part via a convenience method.
      Overrides:
      setPartShortcut in class OpcPackage
      Returns:
      true if the source Part does use the target Part in a convenience method.
    • getMainDocumentPart

      public MainDocumentPart getMainDocumentPart()
    • transform

      public void transform​(javax.xml.transform.Templates xslt, java.util.Map<java.lang.String,​java.lang.Object> transformParameters) throws java.lang.Exception
      Use an XSLT to alter the contents of this package. The output of the transformation must be valid pck:package/pck:part format, as emitted by Word 2007.
      Parameters:
      is -
      transformParameters -
      Throws:
      java.lang.Exception
    • filter

      @Deprecated public void filter​(WordprocessingMLPackage.FilterSettings filterSettings) throws java.lang.Exception
      Deprecated.
      Throws:
      java.lang.Exception
    • setFontMapper

      public void setFontMapper​(Mapper fm) throws java.lang.Exception
      Throws:
      java.lang.Exception
    • setFontMapper

      public void setFontMapper​(Mapper fm, boolean populate) throws java.lang.Exception
      Parameters:
      fm -
      populate -
      Throws:
      java.lang.Exception
      Since:
      3.0.1
    • getFontMapper

      public Mapper getFontMapper()
    • createPackage

      public static WordprocessingMLPackage createPackage() throws InvalidFormatException
      Creates a WordprocessingMLPackage, using default page size and orientation. From 2.7.1, these are read from docx4j.properties, or if not found, default to A4 portrait. The WordprocessingMLPackage contains a MainDocumentPart (with content), Styles part, DocPropsCorePart part, and DocPropsExtendedPart.
      Throws:
      InvalidFormatException
    • createPackage

      public static WordprocessingMLPackage createPackage​(PageSizePaper sz, boolean landscape) throws InvalidFormatException
      Creates a WordprocessingMLPackage, containing a MainDocumentPart (with content), Styles part, DocPropsCorePart part, and DocPropsExtendedPart. The content contains sectPr specifying paper size and orientation.
      Parameters:
      sz -
      landscape -
      Returns:
      Throws:
      InvalidFormatException
    • attachTemplate

      public void attachTemplate​(java.lang.String templatePath)
      Attach a template to this document. This is just an easy way to access the same method in DocumentSettingsPart (which lives under the MainDocumentPart)
      Parameters:
      templatePath -
      Since:
      6.1.0
    • finalize

      protected void finalize() throws java.lang.Throwable
      Overrides:
      finalize in class java.lang.Object
      Throws:
      java.lang.Throwable
    • reset

      public void reset()
      Reinit fields so this pkg object can be re-used.
      Overrides:
      reset in class OpcPackage
      Since:
      3.3.7