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
- Author:
- jharrop
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected GlossaryDocumentPartprotected static org.slf4j.Loggerprotected MainDocumentPartFields inherited from class org.docx4j.openpackaging.packages.OpcPackage
contentTypeManager, customXmlDataStorageParts, docPropsCorePart, docPropsCustomPart, docPropsExtendedPart, externalResources, handled, partsFields inherited from class org.docx4j.openpackaging.Base
contentType, partName, relationships -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.WordprocessingMLPackage(ContentTypeManager contentTypeManager) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidattachTemplate(String templatePath) Attach a template to this document.static WordprocessingMLPackageCreates a WordprocessingMLPackage, using default page size and orientation.static WordprocessingMLPackagecreatePackage(PageSizePaper sz, boolean landscape) Creates a WordprocessingMLPackage, containing a MainDocumentPart (with content), Styles part, DocPropsCorePart part, and DocPropsExtendedPart.voidfilter(WordprocessingMLPackage.FilterSettings filterSettings) Deprecated.protected voidfinalize()Deprecated.static WordprocessingMLPackageConvenience method to create a WordprocessingMLPackage from an existing File (.docx zip or .xml Flat OPC).static WordprocessingMLPackageload(InputStream is) Convenience method to create a WordprocessingMLPackage from an existing stream(.docx zip or .xml Flat OPC).voidreset()Reinit fields so this pkg object can be re-used.voidsetFontMapper(Mapper fm) voidsetFontMapper(Mapper fm, boolean populate) booleansetPartShortcut(Part part, String relationshipType) Tell the source Part about this target Part, so the source can use this part via a convenience method.voidUse an XSLT to alter the contents of this package.Methods inherited from class org.docx4j.openpackaging.packages.OpcPackage
addDocPropsCorePart, addDocPropsCustomPart, addDocPropsExtendedPart, clone, cloneAs, getContentTypeManager, getCustomXmlDataStorageParts, getDocPropsCorePart, getDocPropsCustomPart, getDocPropsExtendedPart, getDrawingPropsIdTracker, getExternalResources, getPackage, getParts, getSourcePartStore, getTargetPartStore, getTitle, isNew, load, load, load, load, load, load, load, load, load, load, name, save, save, save, save, save, save, setContentTypeManager, setName, setNew, setSourcePartStore, setTargetPartStore, setTitleMethods inherited from class org.docx4j.openpackaging.Base
addTargetPart, addTargetPart, addTargetPart, addTargetPart, getContentType, getPartName, getRelationshipsPart, getRelationshipsPart, getUserData, setContentType, setPartName, setRelationships, setUserData
-
Field Details
-
log
protected static org.slf4j.Logger log -
mainDoc
-
glossaryDoc
-
-
Constructor Details
-
WordprocessingMLPackage
public WordprocessingMLPackage()Constructor. Also creates a new content type manager -
WordprocessingMLPackage
Constructor.- Parameters:
contentTypeManager- The content type manager to use
-
-
Method Details
-
getProtectionSettings
-
getDocumentModel
-
load
Convenience method to create a WordprocessingMLPackage from an existing File (.docx zip or .xml Flat OPC).- Parameters:
docxFile- The docx file- Throws:
Docx4JException
-
load
Convenience method to create a WordprocessingMLPackage from an existing stream(.docx zip or .xml Flat OPC).- Parameters:
docxFile- The docx file- Throws:
Docx4JException
-
setPartShortcut
Description copied from class:BaseTell the source Part about this target Part, so the source can use this part via a convenience method.- Overrides:
setPartShortcutin classOpcPackage- Returns:
- true if the source Part does use the target Part in a convenience method.
-
getMainDocumentPart
-
transform
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:
Exception
-
filter
@Deprecated public void filter(WordprocessingMLPackage.FilterSettings filterSettings) throws Exception Deprecated.- Throws:
Exception
-
setFontMapper
- Throws:
Exception
-
setFontMapper
- Parameters:
fm-populate-- Throws:
Exception- Since:
- 3.0.1
-
getFontMapper
-
createPackage
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
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
-
reset
public void reset()Reinit fields so this pkg object can be re-used.- Overrides:
resetin classOpcPackage- Since:
- 3.3.7
-