Package org.apache.poi.hwpf
Class HWPFOldDocument
java.lang.Object
org.apache.poi.POIDocument
org.apache.poi.hwpf.HWPFDocumentCore
org.apache.poi.hwpf.HWPFOldDocument
- All Implemented Interfaces:
Closeable
,AutoCloseable
Provides very simple support for old (Word 6 / Word 95)
files.
-
Field Summary
Fields inherited from class org.apache.poi.hwpf.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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionUsegetOldFontTable()
instead!!! This always throws an IllegalArgumentException.As a rough heuristic (total hack), read through the HPSF, then read through the font table, and take the first non-default, non-ansi, non-symbol font's charset and return that.Returns the range that covers all text in the file, including main text, footnotes, headers and commentsgetRange()
Returns the range which covers the whole of the document, but excludes any headers and footers.getText()
Internal method to access document textvoid
write()
Writes the document out to the currently openFile
, via the writeablePOIFSFileSystem
it was opened from.void
Writes the document out to the specified newFile
.void
write
(OutputStream out) Writes the document out to the specified output stream.Methods inherited from class org.apache.poi.hwpf.HWPFDocumentCore
getCharacterTable, getDocumentEntryBytes, getDocumentText, getEncryptionInfo, getFileInformationBlock, getListTables, getMainStream, getObjectsPool, getParagraphTable, getSectionTable, getStyleSheet, updateEncryptionInfo, verifyAndBuildPOIFS
Methods inherited from class org.apache.poi.POIDocument
clearDirectory, close, createInformationProperties, getDirectory, getDocumentSummaryInformation, getEncryptedPropertyStreamName, getPropertySet, getPropertySet, getSummaryInformation, initDirectory, readProperties, replaceDirectory, validateInPlaceWritePossible, writeProperties, writeProperties, writeProperties
-
Constructor Details
-
HWPFOldDocument
- Throws:
IOException
-
HWPFOldDocument
- Throws:
IOException
-
-
Method Details
-
getOverallRange
Description copied from class:HWPFDocumentCore
Returns the range that covers all text in the file, including main text, footnotes, headers and comments- Specified by:
getOverallRange
in classHWPFDocumentCore
-
getFontTable
UsegetOldFontTable()
instead!!! This always throws an IllegalArgumentException.- Overrides:
getFontTable
in classHWPFDocumentCore
- Returns:
- nothing
- Throws:
UnsupportedOperationException
-
getOldFontTable
-
getRange
Description copied from class:HWPFDocumentCore
Returns the range which covers the whole of the document, but excludes any headers and footers.- Specified by:
getRange
in classHWPFDocumentCore
-
getTextTable
- Specified by:
getTextTable
in classHWPFDocumentCore
-
getText
Description copied from class:HWPFDocumentCore
Internal method to access document text- Specified by:
getText
in classHWPFDocumentCore
-
write
Description copied from class:POIDocument
Writes the document out to the currently openFile
, via the writeablePOIFSFileSystem
it was opened from.This will fail (with an
IllegalStateException
if the document was opened read-only, opened from anInputStream
instead of a File, or if this is not the root document. For those cases, you must usePOIDocument.write(OutputStream)
orPOIDocument.write(File)
to write to a brand new document.- Specified by:
write
in classPOIDocument
- Throws:
IOException
- thrown on errors writing to the file
-
write
Description copied from class:POIDocument
Writes the document out to the specified newFile
. If the file exists, it will be replaced, otherwise a new one will be created- Specified by:
write
in classPOIDocument
- Parameters:
out
- The new File to write to.- Throws:
IOException
- thrown on errors writing to the file
-
write
Description copied from class:POIDocument
Writes the document out to the specified output stream. The stream is not closed as part of this operation. Note - if the Document was opened from aFile
rather than anInputStream
, you must write out usingPOIDocument.write()
or to a different File. Overwriting the currently open file via an OutputStream isn't possible. Ifstream
is aFileOutputStream
on a networked drive or has a high cost/latency associated with each written byte, consider wrapping the OutputStream in aBufferedOutputStream
to improve write performance, or usePOIDocument.write()
/POIDocument.write(File)
if possible.- Specified by:
write
in classPOIDocument
- Parameters:
out
- The stream to write to.- Throws:
IOException
- thrown on errors writing to the stream
-
getGuessedCharset
As a rough heuristic (total hack), read through the HPSF, then read through the font table, and take the first non-default, non-ansi, non-symbol font's charset and return that. Once we figure out how to link a font to a text piece, we should use the font information per text piece.- Returns:
- charset
-