org.apache.poi.hwpf
Class HWPFDocument

java.lang.Object
  extended by org.apache.poi.POIDocument
      extended by org.apache.poi.hwpf.HWPFDocument

public class HWPFDocument
extends POIDocument

This class acts as the bucket that we throw all of the Word data structures into.

Author:
Ryan Ackley

Field Summary
protected  CHPBinTable _cbt
          Contains formatting properties for text
protected  ComplexFileTable _cft
          Contains text of the document wrapped in a obfuscated Word data structure
protected  byte[] _dataStream
          data stream buffer
protected  EscherRecordHolder _dgg
          Escher Drawing Group information
protected  DocumentProperties _dop
          Document wide Properties
protected  FileInformationBlock _fib
          The FIB
protected  FSPATable _fspa
          Holds FSBA (shape) information
protected  FontTable _ft
          Holds fonts for this document.
protected  ListTables _lt
          Hold list tables
protected  byte[] _mainStream
          main document stream buffer
protected  PAPBinTable _pbt
          Contains formatting properties for paragraphs
protected  PicturesTable _pictures
          Holds pictures table
protected  SavedByTable _sbt
          Holds the save history for this document.
protected  StyleSheet _ss
          Holds styles for this document.
protected  SectionTable _st
          Contains formatting properties for sections.
protected  byte[] _tableStream
          table stream buffer
protected  TextPieceTable _tpt
           
 
Fields inherited from class org.apache.poi.POIDocument
directory, dsInf, filesystem, initialized, logger, sInf
 
Constructor Summary
protected HWPFDocument()
           
  HWPFDocument(DirectoryNode directory, POIFSFileSystem pfilesystem)
          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
 
Method Summary
 int characterLength()
          Returns the character length of a document.
 void delete(int start, int length)
           
 CHPBinTable getCharacterTable()
           
 byte[] getDataStream()
           
 DocumentProperties getDocProperties()
           
 FileInformationBlock getFileInformationBlock()
           
 FontTable getFontTable()
           
 ListTables getListTables()
           
 PAPBinTable getParagraphTable()
           
 PicturesTable getPicturesTable()
           
 Range getRange()
           
 SavedByTable getSavedByTable()
          Gets a reference to the saved -by table, which holds the save history for the document.
 SectionTable getSectionTable()
           
 StyleSheet getStyleSheet()
           
 TextPieceTable getTextTable()
           
static void main(java.lang.String[] args)
          Takes two arguments, 1) name of the Word file to read in 2) location to write it out at.
 int registerList(HWPFList list)
           
static POIFSFileSystem verifyAndBuildPOIFS(java.io.InputStream istream)
          Takens an InputStream, verifies that it's not RTF, builds a POIFSFileSystem from it, and returns that.
 void write(java.io.OutputStream out)
          Writes out the word file that is represented by an instance of this class.
 
Methods inherited from class org.apache.poi.POIDocument
copyNodes, getDocumentSummaryInformation, getPropertySet, getSummaryInformation, readProperties, writeProperties, writeProperties, writePropertySet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_fib

protected FileInformationBlock _fib
The FIB


_mainStream

protected byte[] _mainStream
main document stream buffer


_tableStream

protected byte[] _tableStream
table stream buffer


_dataStream

protected byte[] _dataStream
data stream buffer


_dop

protected DocumentProperties _dop
Document wide Properties


_cft

protected ComplexFileTable _cft
Contains text of the document wrapped in a obfuscated Word data structure


_tpt

protected TextPieceTable _tpt

_cbt

protected CHPBinTable _cbt
Contains formatting properties for text


_pbt

protected PAPBinTable _pbt
Contains formatting properties for paragraphs


_st

protected SectionTable _st
Contains formatting properties for sections.


_ss

protected StyleSheet _ss
Holds styles for this document.


_ft

protected FontTable _ft
Holds fonts for this document.


_lt

protected ListTables _lt
Hold list tables


_sbt

protected SavedByTable _sbt
Holds the save history for this document.


_pictures

protected PicturesTable _pictures
Holds pictures table


_fspa

protected FSPATable _fspa
Holds FSBA (shape) information


_dgg

protected EscherRecordHolder _dgg
Escher Drawing Group information

Constructor Detail

HWPFDocument

protected HWPFDocument()

HWPFDocument

public HWPFDocument(java.io.InputStream istream)
             throws java.io.IOException
This constructor loads a Word document from an InputStream.

Parameters:
istream - The InputStream that contains the Word document.
Throws:
java.io.IOException - If there is an unexpected IOException from the passed in InputStream.

HWPFDocument

public HWPFDocument(POIFSFileSystem pfilesystem)
             throws java.io.IOException
This constructor loads a Word document from a POIFSFileSystem

Parameters:
pfilesystem - The POIFSFileSystem that contains the Word document.
Throws:
java.io.IOException - If there is an unexpected IOException from the passed in POIFSFileSystem.

HWPFDocument

public HWPFDocument(DirectoryNode directory,
                    POIFSFileSystem pfilesystem)
             throws java.io.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:
pfilesystem - The POIFSFileSystem that contains the Word document.
Throws:
java.io.IOException - If there is an unexpected IOException from the passed in POIFSFileSystem.
Method Detail

verifyAndBuildPOIFS

public static POIFSFileSystem verifyAndBuildPOIFS(java.io.InputStream istream)
                                           throws java.io.IOException
Takens an InputStream, verifies that it's not RTF, builds a POIFSFileSystem from it, and returns that.

Throws:
java.io.IOException

getStyleSheet

public StyleSheet getStyleSheet()

getFileInformationBlock

public FileInformationBlock getFileInformationBlock()

getDocProperties

public DocumentProperties getDocProperties()

getRange

public Range getRange()

characterLength

public int characterLength()
Returns the character length of a document.

Returns:
the character length of a document

getListTables

public ListTables getListTables()

getSavedByTable

public SavedByTable getSavedByTable()
Gets a reference to the saved -by table, which holds the save history for the document.

Returns:
the saved-by table.

getPicturesTable

public PicturesTable getPicturesTable()
Returns:
PicturesTable object, that is able to extract images from this document

write

public void write(java.io.OutputStream out)
           throws java.io.IOException
Writes out the word file that is represented by an instance of this class.

Specified by:
write in class POIDocument
Parameters:
out - The OutputStream to write to.
Throws:
java.io.IOException - If there is an unexpected IOException from the passed in OutputStream.

getCharacterTable

public CHPBinTable getCharacterTable()

getParagraphTable

public PAPBinTable getParagraphTable()

getSectionTable

public SectionTable getSectionTable()

getTextTable

public TextPieceTable getTextTable()

getDataStream

public byte[] getDataStream()

registerList

public int registerList(HWPFList list)

getFontTable

public FontTable getFontTable()

delete

public void delete(int start,
                   int length)

main

public static void main(java.lang.String[] args)
Takes two arguments, 1) name of the Word file to read in 2) location to write it out at.

Parameters:
args -


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