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.
(获取对保存的-by 表的引用,该表包含文档的保存历史记录。)
|
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.
(通过打开它的可写 POIFSFileSystem 将这个类表示的 word 文件写到当前打开的 File 中。)
|
void |
write(java.io.File newFile)
Writes out the word file that is represented by an instance of this class.
(写出由此类的实例表示的 word 文件。)
|
void |
write(java.io.OutputStream out)
Writes out the word file that is represented by an instance of this class.
(写出由此类的实例表示的 word 文件。)
|
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.
(istream - 包含 Word 文档的 InputStream。)
java.io.IOException
- If there is an unexpected IOException from the passed in InputStream.
(java.io.IOException - 如果传入的 InputStream 出现意外的 IOException。)
public HWPFDocument(POIFSFileSystem pfilesystem) throws java.io.IOException
pfilesystem
- The POIFSFileSystem that contains the Word document.
(pfilesystem - 包含 Word 文档的 POIFSFileSystem。)
java.io.IOException
- If there is an unexpected IOException from the passed in POIFSFileSystem.
(java.io.IOException - 如果传入的 POIFSFileSystem 出现意外的 IOException。)
public HWPFDocument(DirectoryNode directory) throws java.io.IOException
directory
- The DirectoryNode that contains the Word document.
(directory - 包含 Word 文档的 DirectoryNode。)
java.io.IOException
- If there is an unexpected IOException from the passed in POIFSFileSystem.
(java.io.IOException - 如果传入的 POIFSFileSystem 出现意外的 IOException。)
@Internal public TextPieceTable getTextTable()
getTextTable
in class
HWPFDocumentCore
(类 HWPFDocumentCore 中的 getTextTable)
@Internal public java.lang.StringBuilder getText()
HWPFDocumentCore
getText
in class
HWPFDocumentCore
(类 HWPFDocumentCore 中的 getText)
public DocumentProperties getDocProperties()
public Range getOverallRange()
HWPFDocumentCore
getOverallRange
in class
HWPFDocumentCore
(类 HWPFDocumentCore 中的 getOverallRange)
public Range getRange()
getRange
in class
HWPFDocumentCore
(类 HWPFDocumentCore 中的 getRange)
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
s
(返回访问文档字段的用户友好界面)
Field
s
(访问文档字段的用户友好界面)
public 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
(写在类 POIDocument)
java.io.IOException
- thrown on errors writing to the file
(java.io.IOException - 写入文件出错时抛出)
public 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
(写在类 POIDocument)
newFile
- The File to write to.
(newFile - 要写入的文件。)
java.io.IOException
- If there is an unexpected IOException from writing to the File.
(java.io.IOException - 如果写入文件时出现意外 IOException。)
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
(写在类 POIDocument)
out
- The OutputStream to write to.
(out - 要写入的 OutputStream。)
java.io.IOException
- If there is an unexpected IOException from the passed in OutputStream.
(java.io.IOException - 如果传入的 OutputStream 中出现意外的 IOException。)
@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.