Package org.apache.poi.hwpf
Class HWPFDocumentCore
java.lang.Object
org.apache.poi.POIDocument
org.apache.poi.hwpf.HWPFDocumentCore
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
HWPFDocument,HWPFOldDocument
This class holds much of the core of a Word document, but
without some of the table structure information.
You generally want to work with one of
HWPFDocument or HWPFOldDocument-
Constructor Summary
ConstructorsConstructorDescriptionHWPFDocumentCore(InputStream istream) This constructor loads a Word document from an InputStream.HWPFDocumentCore(DirectoryNode directory) This constructor loads a Word document from a specific point in a POIFSFileSystem, probably not the default.HWPFDocumentCore(POIFSFileSystem pfilesystem) This constructor loads a Word document from a POIFSFileSystem -
Method Summary
Modifier and TypeMethodDescriptionReturns document text, i.e.byte[]static intabstract RangeReturns the range that covers all text in the file, including main text, footnotes, headers and commentsabstract RangegetRange()Returns the range which covers the whole of the document, but excludes any headers and footers.abstract StringBuildergetText()Internal method to access document textabstract TextPieceTablestatic voidsetMaxRecordLength(int length) static POIFSFileSystemverifyAndBuildPOIFS(InputStream istream) Takes an InputStream, verifies that it's not RTF or PDF, builds a POIFSFileSystem from it, and returns that.Methods inherited from class org.apache.poi.POIDocument
close, createInformationProperties, getDirectory, getDocumentSummaryInformation, getSummaryInformation, readProperties, write, write, write, writeProperties
-
Constructor Details
-
HWPFDocumentCore
This constructor loads a Word document from an InputStream.- Parameters:
istream- The InputStream that contains the Word document.- Throws:
IOException- If there is an unexpected IOException from the passed in InputStream.
-
HWPFDocumentCore
This constructor loads a Word document from a POIFSFileSystem- Parameters:
pfilesystem- The POIFSFileSystem that contains the Word document.- Throws:
IOException- If there is an unexpected IOException from the passed in POIFSFileSystem.
-
HWPFDocumentCore
This constructor loads a Word document from a specific point in a POIFSFileSystem, probably not the default. Used typically to open embedded documents.- Parameters:
directory- The DirectoryNode that contains the Word document.- Throws:
IOException- If there is an unexpected IOException from the passed in POIFSFileSystem.
-
-
Method Details
-
setMaxRecordLength
public static void setMaxRecordLength(int length) - Parameters:
length- the max record length allowed for HWPFDocumentCore
-
getMaxRecordLength
public static int getMaxRecordLength()- Returns:
- the max record length allowed for HWPFDocumentCore
-
verifyAndBuildPOIFS
Takes an InputStream, verifies that it's not RTF or PDF, builds a POIFSFileSystem from it, and returns that.- Throws:
IOException
-
getRange
Returns the range which covers the whole of the document, but excludes any headers and footers. -
getOverallRange
Returns the range that covers all text in the file, including main text, footnotes, headers and comments -
getDocumentText
Returns document text, i.e. text information from all text pieces, including OLE descriptions and field codes -
getText
Internal method to access document text -
getCharacterTable
-
getParagraphTable
-
getSectionTable
-
getStyleSheet
-
getListTables
-
getFontTable
-
getFileInformationBlock
-
getObjectsPool
-
getTextTable
-
getMainStream
-
getEncryptionInfo
- Overrides:
getEncryptionInfoin classPOIDocument- Returns:
- the encryption info if the document is encrypted, otherwise
null - Throws:
IOException- If retrieving the encryption information fails
-