title: How to use Apache HWPF to extract text and images out of a DOC file
body: <p>I downloaded the <a href="http://poi.apache.org/hwpf/index.html" rel="nofollow noreferrer">Apache HWPF</a>. I want to use it to read a doc file and write its text into a plain text file. I don't know the HWPF so well.</p>
  
  <p>My very simple program is here:</p>
  
  <p>I have 3 problems now:</p>
  
  <ol>
  <li><p>Some of packages have errors (they can't find apache hdf). How I can fix them?</p></li>
  <li><p>How I can use the methods of HWDF to find and extract the images out?</p></li>
  <li><p>Some piece of my program is incomplete and incorrect. So please help me to complete it.</p></li>
  </ol>
  
  <p>I have to complete this program in 2 days.</p>
  
  <p>once again I repeat Please Please help me to complete this.</p>
  
  <p>Thanks you Guys a lot for your help!!!</p>
  
  <p>This is my elementary code :</p>
  
  <pre><code>public class test {
    public void m1 (){
      String filesname = "Hello.doc";
      POIFSFileSystem fs = null;
      fs = new POIFSFileSystem(new FileInputStream(filesname ); 
      HWPFDocument doc = new HWPFDocument(fs);
      WordExtractor we = new WordExtractor(doc);
      String str = we.getText() ;
      String[] paragraphs = we.getParagraphText();
      Picture pic = new Picture(. . .) ;
      pic.writeImageContent( . . . ) ;
      PicturesTable picTable = new PicturesTable( . . . ) ;
      if ( picTable.hasPicture( . . . ) ){
        picTable.extractPicture(..., ...);
        picTable.getAllPictures() ;
      }
  }
  </code></pre>