Package org.docx4j.convert.in
Class FlatOpcXmlImporter
java.lang.Object
org.docx4j.convert.in.FlatOpcXmlImporter
Create a Package object from an
XmlPackage object.
Microsoft Word and Powerpoint both support
saving to this format. Excel doesn't, but you
can still have a spreadsheet in this format if you want to.
"<?xml version=""1.0"" standalone=""yes""?>
<?mso-application progid=""Word.Document""?>
<pkg:package xmlns:pkg=""http://schemas.microsoft.com/office/2006/xmlPackage"">
<pkg:part pkg:name=
pkg:contentType=
pkg:padding=""512""> (@padding is only on rels)
<pkg:xmlData>
<pkg:part pkg:name=""/word/media/image2.jpeg""
pkg:contentType=""image/jpeg""
pkg:compression=""store""> (@compression is only on binary parts)
<pkg:binaryData>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ContentTypeManagerThis HashMap is intended to prevent loops.private static org.slf4j.Loggerprivate OpcPackage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddPartsFromRelationships(Base source, RelationshipsPart rp) get()private voidgetPart(RelationshipsPart rp, Relationship r) Get a Part (except a relationships part), and all its related parts.getRawPart(ContentTypeManager ctm, String resolvedPartUri, Relationship rel) private PartgetRawPart(ContentTypeManager ctm, Part pkgPart, Relationship rel) static PartgetRawPart(ContentTypeManager ctm, Part pkgPart, Relationship rel, OpcPackage targetPkg) getRelationshipsPart(Part part) Get the Relationships Part (if there is one) for a given Part.private RelationshipsPartgetRelationshipsPartFromXmlPackage(Base p, String partName) private voidstatic RelationshipsPart
-
Field Details
-
log
private static org.slf4j.Logger log -
parts
-
ctm
-
handled
This HashMap is intended to prevent loops. -
packageResult
-
-
Constructor Details
-
FlatOpcXmlImporter
- Throws:
jakarta.xml.bind.JAXBException
-
FlatOpcXmlImporter
-
-
Method Details
-
init
-
get
- Throws:
Docx4JException
-
getRelationshipsPartFromXmlPackage
private RelationshipsPart getRelationshipsPartFromXmlPackage(Base p, String partName) throws Docx4JException - Throws:
Docx4JException
-
populateRelationshipsPart
public static RelationshipsPart populateRelationshipsPart(RelationshipsPart rp, Element el) throws InvalidFormatException, jakarta.xml.bind.JAXBException - Throws:
InvalidFormatExceptionjakarta.xml.bind.JAXBException
-
addPartsFromRelationships
- Throws:
Docx4JException
-
getPart
private void getPart(RelationshipsPart rp, Relationship r) throws Docx4JException, InvalidFormatException, URISyntaxException Get a Part (except a relationships part), and all its related parts. This can be called directly from outside the library, in which case the Part will not be owned by a Package until the calling code makes it so.- Parameters:
zf-source-unusedZipEntries-r-resolvedPartUri-- Throws:
Docx4JExceptionInvalidFormatExceptionURISyntaxException
-
getRelationshipsPart
public RelationshipsPart getRelationshipsPart(Part part) throws Docx4JException, InvalidFormatException Get the Relationships Part (if there is one) for a given Part. Otherwise return null.- Parameters:
zf-part-- Returns:
- Throws:
InvalidFormatExceptionDocx4JException
-
getRawPart
public Part getRawPart(ContentTypeManager ctm, String resolvedPartUri, Relationship rel) throws Docx4JException - Throws:
Docx4JException
-
getRawPart
private Part getRawPart(ContentTypeManager ctm, Part pkgPart, Relationship rel) throws Docx4JException - Parameters:
ctm-pkgPart-rel-- Returns:
- Throws:
Docx4JException- Since:
- 11.4.6
-
getRawPart
public static Part getRawPart(ContentTypeManager ctm, Part pkgPart, Relationship rel, OpcPackage targetPkg) throws Docx4JException - Throws:
Docx4JException
-