public abstract class POIXMLDocument extends POIXMLDocumentPart implements Closeable
POIXMLDocumentPart.RelationPart| Modifier and Type | Field and Description |
|---|---|
static String |
DOCUMENT_CREATOR |
static String |
OLE_OBJECT_REL_TYPE |
static String |
PACK_OBJECT_REL_TYPE |
| Modifier | Constructor and Description |
|---|---|
protected |
POIXMLDocument(OPCPackage pkg) |
protected |
POIXMLDocument(OPCPackage pkg,
String coreDocumentRel) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the underlying
OPCPackage from which this
document was read, if there is one |
abstract List<PackagePart> |
getAllEmbeddedParts()
Get the document's embedded files.
|
protected PackagePart |
getCorePart() |
OPCPackage |
getPackage()
Get the assigned OPCPackage
|
POIXMLProperties |
getProperties()
Get the document properties.
|
protected PackagePart[] |
getRelatedByType(String contentType)
Retrieves all the PackageParts which are defined as relationships of the base document with the
specified content type.
|
protected void |
load(POIXMLFactory factory) |
static OPCPackage |
openPackage(String path)
Wrapper to open a package, which works around shortcomings in java's this() constructor calls
|
void |
write(OutputStream stream)
Write out this document to an
OutputStream. |
_invokeOnDocumentRead, addRelation, commit, createRelationship, createRelationship, createRelationship, getNextPartNumber, getPackagePart, getParent, getRelationById, getRelationId, getRelationPartById, getRelationParts, getRelations, getTargetPart, isCommitted, onDocumentCreate, onDocumentRead, onDocumentRemove, onSave, prepareForCommit, read, rebase, removeRelation, removeRelation, removeRelation, setCommitted, toStringpublic static final String DOCUMENT_CREATOR
public static final String OLE_OBJECT_REL_TYPE
public static final String PACK_OBJECT_REL_TYPE
protected POIXMLDocument(OPCPackage pkg)
protected POIXMLDocument(OPCPackage pkg, String coreDocumentRel)
public static OPCPackage openPackage(String path) throws IOException
path - the path to the documentIOException - if there was a problem opening the documentpublic OPCPackage getPackage()
protected PackagePart getCorePart()
protected PackagePart[] getRelatedByType(String contentType) throws InvalidFormatException
contentType - the content typeInvalidFormatException - when the relationships or the parts contain errorsXSSFRelation,
XSLFRelation,
XWPFRelation,
XDGFRelationpublic POIXMLProperties getProperties()
public abstract List<PackagePart> getAllEmbeddedParts() throws OpenXML4JException
OpenXML4JException - if the embedded parts can't be determinedprotected final void load(POIXMLFactory factory) throws IOException
IOExceptionpublic void close()
throws IOException
OPCPackage from which this
document was read, if there is one
Once this has been called, no further operations, updates or reads should be performed on the document.
close in interface Closeableclose in interface AutoCloseableIOException - for writable packages, if an IO exception occur during the saving process.public final void write(OutputStream stream) throws IOException
OutputStream.
Note - if the Document was opened from a File rather
than an InputStream, you must write out to
a different file, overwriting via an OutputStream isn't possible.
If stream is a FileOutputStream on a networked drive
or has a high cost/latency associated with each written byte,
consider wrapping the OutputStream in a BufferedOutputStream
to improve write performance.stream - - the java OutputStream you wish to write the file toIOException - if anything can't be written.