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
public abstract class HWPFDocumentCore extends POIDocument
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 ofHWPFDocument
orHWPFOldDocument
-
-
Constructor Summary
Constructors Constructor Description HWPFDocumentCore(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
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description CHPBinTable
getCharacterTable()
String
getDocumentText()
Returns document text, i.e.EncryptionInfo
getEncryptionInfo()
FileInformationBlock
getFileInformationBlock()
FontTable
getFontTable()
ListTables
getListTables()
byte[]
getMainStream()
ObjectsPool
getObjectsPool()
abstract Range
getOverallRange()
Returns the range that covers all text in the file, including main text, footnotes, headers and commentsPAPBinTable
getParagraphTable()
abstract Range
getRange()
Returns the range which covers the whole of the document, but excludes any headers and footers.SectionTable
getSectionTable()
StyleSheet
getStyleSheet()
abstract StringBuilder
getText()
Internal method to access document textabstract TextPieceTable
getTextTable()
static POIFSFileSystem
verifyAndBuildPOIFS(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, write, write, write
-
-
-
-
Constructor Detail
-
HWPFDocumentCore
public HWPFDocumentCore(InputStream istream) throws IOException
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
public HWPFDocumentCore(POIFSFileSystem pfilesystem) throws IOException
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
public HWPFDocumentCore(DirectoryNode directory) throws IOException
This constructor loads a Word document from a specific point in a POIFSFileSystem, probably not the default. Used typically to open embeded documents.- Parameters:
directory
- The DirectoryNode that contains the Word document.- Throws:
IOException
- If there is an unexpected IOException from the passed in POIFSFileSystem.
-
-
Method Detail
-
verifyAndBuildPOIFS
public static POIFSFileSystem verifyAndBuildPOIFS(InputStream istream) throws IOException
Takes an InputStream, verifies that it's not RTF or PDF, builds a POIFSFileSystem from it, and returns that.- Throws:
IOException
-
getRange
public abstract Range getRange()
Returns the range which covers the whole of the document, but excludes any headers and footers.
-
getOverallRange
public abstract Range getOverallRange()
Returns the range that covers all text in the file, including main text, footnotes, headers and comments
-
getDocumentText
public String getDocumentText()
Returns document text, i.e. text information from all text pieces, including OLE descriptions and field codes
-
getText
@Internal public abstract StringBuilder getText()
Internal method to access document text
-
getCharacterTable
public CHPBinTable getCharacterTable()
-
getParagraphTable
public PAPBinTable getParagraphTable()
-
getSectionTable
public SectionTable getSectionTable()
-
getStyleSheet
public StyleSheet getStyleSheet()
-
getListTables
public ListTables getListTables()
-
getFontTable
public FontTable getFontTable()
-
getFileInformationBlock
public FileInformationBlock getFileInformationBlock()
-
getObjectsPool
public ObjectsPool getObjectsPool()
-
getTextTable
public abstract TextPieceTable getTextTable()
-
getMainStream
@Internal public byte[] getMainStream()
-
getEncryptionInfo
public EncryptionInfo getEncryptionInfo() throws IOException
- Overrides:
getEncryptionInfo
in classPOIDocument
- Returns:
- the encryption info if the document is encrypted, otherwise
null
- Throws:
IOException
- If retrieving the encryption information fails
-
-