public final class HWPFDocument extends HWPFDocumentCore
_cbt, _fib, _ft, _lt, _mainStream, _objectPool, _pbt, _ss, _st, FIB_BASE_LEN, RC4_REKEYING_INTERVAL, STREAM_OBJECT_POOL, STREAM_TABLE_0, STREAM_TABLE_1, STREAM_WORD_DOCUMENT
Constructor and Description |
---|
HWPFDocument(DirectoryNode directory)
This constructor loads a Word document from a specific point
in a POIFSFileSystem, probably not the default.
|
HWPFDocument(java.io.InputStream istream)
This constructor loads a Word document from an InputStream.
|
HWPFDocument(POIFSFileSystem pfilesystem)
This constructor loads a Word document from a POIFSFileSystem
|
Modifier and Type | Method and Description |
---|---|
int |
characterLength()
Returns the character length of a document.
|
void |
delete(int start,
int length) |
Bookmarks |
getBookmarks() |
Range |
getCommentsRange()
Returns the
Range which covers all annotations. |
byte[] |
getDataStream() |
DocumentProperties |
getDocProperties() |
Range |
getEndnoteRange()
Returns the
Range which covers all endnotes. |
Notes |
getEndnotes() |
EscherRecordHolder |
getEscherRecordHolder() |
Fields |
getFields()
Returns user-friendly interface to access document
Field s |
Range |
getFootnoteRange()
Returns the
Range which covers all the Footnotes. |
Notes |
getFootnotes() |
Range |
getHeaderStoryRange()
Returns the range which covers all "Header Stories".
|
Range |
getMainTextboxRange()
Returns the
Range which covers all textboxes. |
OfficeDrawings |
getOfficeDrawingsHeaders() |
OfficeDrawings |
getOfficeDrawingsMain() |
Range |
getOverallRange()
Returns the range that covers all text in the file, including main text,
footnotes, headers and comments
|
PicturesTable |
getPicturesTable() |
Range |
getRange()
Returns the range which covers the whole of the document, but excludes
any headers and footers.
|
RevisionMarkAuthorTable |
getRevisionMarkAuthorTable()
Gets a reference to the revision mark author table, which holds the revision mark authors for the document.
|
SavedByTable |
getSavedByTable()
Gets a reference to the saved -by table, which holds the save history for the document.
|
byte[] |
getTableStream() |
java.lang.StringBuilder |
getText()
Internal method to access document text
|
TextPieceTable |
getTextTable() |
int |
registerList(HWPFList list) |
void |
write()
Write out the word file that is represented by this class, to the
currently open
File , via the writeable POIFSFileSystem
it was opened as. |
void |
write(java.io.File newFile)
Writes out the word file that is represented by an instance of this class.
|
void |
write(java.io.OutputStream out)
Writes out the word file that is represented by an instance of this class.
|
getCharacterTable, getDocumentEntryBytes, getDocumentText, getEncryptionInfo, getFileInformationBlock, getFontTable, getListTables, getMainStream, getObjectsPool, getParagraphTable, getSectionTable, getStyleSheet, updateEncryptionInfo, verifyAndBuildPOIFS
clearDirectory, close, createInformationProperties, getDirectory, getDocumentSummaryInformation, getEncryptedPropertyStreamName, getPropertySet, getPropertySet, getSummaryInformation, initDirectory, readProperties, replaceDirectory, validateInPlaceWritePossible, writeProperties, writeProperties, writeProperties
public HWPFDocument(java.io.InputStream istream) throws java.io.IOException
istream
- The InputStream that contains the Word document.java.io.IOException
- If there is an unexpected IOException from the passed
in InputStream.public HWPFDocument(POIFSFileSystem pfilesystem) throws java.io.IOException
pfilesystem
- The POIFSFileSystem that contains the Word document.java.io.IOException
- If there is an unexpected IOException from the passed
in POIFSFileSystem.public HWPFDocument(DirectoryNode directory) throws java.io.IOException
directory
- The DirectoryNode that contains the Word document.java.io.IOException
- If there is an unexpected IOException from the passed
in POIFSFileSystem.@Internal public TextPieceTable getTextTable()
getTextTable
in class HWPFDocumentCore
@Internal public java.lang.StringBuilder getText()
HWPFDocumentCore
getText
in class HWPFDocumentCore
public DocumentProperties getDocProperties()
public Range getOverallRange()
HWPFDocumentCore
getOverallRange
in class HWPFDocumentCore
public Range getRange()
getRange
in class HWPFDocumentCore
public Range getFootnoteRange()
Range
which covers all the Footnotes.Range
which covers all the Footnotes.public Range getEndnoteRange()
Range
which covers all endnotes.Range
which covers all endnotes.public Range getCommentsRange()
Range
which covers all annotations.Range
which covers all annotations.public Range getMainTextboxRange()
Range
which covers all textboxes.Range
which covers all textboxes.public Range getHeaderStoryRange()
public int characterLength()
@Internal public SavedByTable getSavedByTable()
@Internal public RevisionMarkAuthorTable getRevisionMarkAuthorTable()
public PicturesTable getPicturesTable()
@Internal public EscherRecordHolder getEscherRecordHolder()
public OfficeDrawings getOfficeDrawingsHeaders()
public OfficeDrawings getOfficeDrawingsMain()
public Bookmarks getBookmarks()
public Notes getEndnotes()
public Notes getFootnotes()
public Fields getFields()
Field
sField
spublic void write() throws java.io.IOException
File
, via the writeable POIFSFileSystem
it was opened as.
This will fail (with an IllegalStateException
if the
Document was opened read-only, opened from an InputStream
instead of a File, or if this is not the root document. For those cases,
you must use write(OutputStream)
or write(File)
to
write to a brand new document.
write
in class POIDocument
java.io.IOException
- thrown on errors writing to the filepublic void write(java.io.File newFile) throws java.io.IOException
If the File
exists, it will be replaced, otherwise a new one
will be created
write
in class POIDocument
newFile
- The File to write to.java.io.IOException
- If there is an unexpected IOException from writing
to the File.public void write(java.io.OutputStream out) throws java.io.IOException
For better performance when writing to files, use write(File)
.
If stream
has a high cost/latency associated with each written byte,
consider wrapping the OutputStream in a BufferedOutputStream
to improve write performance.
write
in class POIDocument
out
- The OutputStream to write to.java.io.IOException
- If there is an unexpected IOException from the passed
in OutputStream.@Internal public byte[] getDataStream()
@Internal public byte[] getTableStream()
public int registerList(HWPFList list)
public void delete(int start, int length)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.