Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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:
  java.io.Closeable

    public class HWPFOldDocument

extends HWPFDocumentCore

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
`HWPFOldDocument(DirectoryNode directory)`
`HWPFOldDocument(POIFSFileSystem fs)`

Method Summary
`FontTable` | `getFontTable()` Use `getOldFontTable()` instead!!! This always throws an IllegalArgumentException.
`java.nio.charset.Charset` | `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.
`OldFontTable` | `getOldFontTable()`
`Range` | `getOverallRange()` Returns the range that covers all text in the file, including main text, footnotes, headers and comments
`Range` | `getRange()` Returns the range which covers the whole of the document, but excludes any headers and footers.
`java.lang.StringBuilder` | `getText()` Internal method to access document text
`TextPieceTable` | `getTextTable()`
`void` | `write()` Writes the document out to the currently open `File`, via the writeable `POIFSFileSystem` it was opened from.
`void` | `write(java.io.File out)` Writes the document out to the specified new `File`.
`void` | `write(java.io.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, writePropertySet`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HWPFOldDocument

    public HWPFOldDocument(POIFSFileSystem fs)
                    throws java.io.IOException

Throws:
  `java.io.IOException`

### HWPFOldDocument

    public HWPFOldDocument(DirectoryNode directory)
                    throws java.io.IOException

Throws:
  `java.io.IOException`

Method Detail

### getOverallRange

    public Range 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 class `HWPFDocumentCore`

### getFontTable

    @NotImplemented
    public FontTable getFontTable()

  Use `getOldFontTable()` instead!!! This always throws an IllegalArgumentException.

  Overrides:
    `getFontTable` in class `HWPFDocumentCore`
  Returns:
    nothing
  Throws:
    `java.lang.UnsupportedOperationException`

### getOldFontTable

    public OldFontTable getOldFontTable()

### getRange

    public Range 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 class `HWPFDocumentCore`

### getTextTable

    public TextPieceTable getTextTable()

  Specified by:
    `getTextTable` in class `HWPFDocumentCore`

### getText

    public java.lang.StringBuilder getText()

  Description copied from class: `HWPFDocumentCore`
  Internal method to access document text

  Specified by:
    `getText` in class `HWPFDocumentCore`

### write

    public void write()
               throws java.io.IOException

  Description copied from class: `POIDocument`
  Writes the document out to the currently open `File`, via the writeable `POIFSFileSystem` it was opened from.

  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 `POIDocument.write(OutputStream)` or `POIDocument.write(File)` to write to a brand new document.

  Specified by:
    `write` in class `POIDocument`
  Throws:
    `java.io.IOException` - thrown on errors writing to the file

### write

    public void write(java.io.File out)
               throws java.io.IOException

  Description copied from class: `POIDocument`
  Writes the document out to the specified new `File`. If the file exists, it will be replaced, otherwise a new one will be created

  Specified by:
    `write` in class `POIDocument`
  Parameters:
    `out` - The new File to write to.
  Throws:
    `java.io.IOException` - thrown on errors writing to the file

### write

    public void write(java.io.OutputStream out)
               throws java.io.IOException

  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 a `File` rather than an `InputStream`, you must write out using `POIDocument.write()` or to a different File. Overwriting the currently open file via an OutputStream isn't possible. If `stream` is a `FileOutputStream` on a networked drive or has a high cost/latency associated with each written byte, consider wrapping the OutputStream in a `BufferedOutputStream` to improve write performance, or use `POIDocument.write()` / `POIDocument.write(File)` if possible.

  Specified by:
    `write` in class `POIDocument`
  Parameters:
    `out` - The stream to write to.
  Throws:
    `java.io.IOException` - thrown on errors writing to the stream

### getGuessedCharset

    public java.nio.charset.Charset 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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.