Results 1 to 1 of 1
- 03-13-2009, 06:16 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 4
- Rep Power
- 0
Using apache for reading a doc file
Hi...!
I downloaded the apace hwpf.I wnat to read a doc file with it and get the text of it and write into another file aauch .txt.
I don't know the hwpf so well.
My very simple program is here:
I have 3 problem now:
1-Some of packages have error ( they can't find apache hdf).I also dowloaded apache aommons and apache model.But it now needs these:
- org.apache.log4j
- org.apache.avalon
- junit.framework.Test
- junit.framework.TestSuite
- org.apache.log
- org.slf4j
2-How I can use the method of hwpf to find and extract the images out?
3-some piece of my program is incomplete and incorrect.So please help me ot complete it.
I have to complete this program in 2 day.
once again I repeate Please Please help me to complete this.
Thanks you Guys a lot for your help!!!:confused::confused::confused:
This is my elemantary code:
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.apache.poi.hwpf.HWPFDocument;
import org.apache.poi.hwpf.extractor.WordExtractor;
import org.apache.poi.hwpf.model.PicturesTable;
import org.apache.poi.hwpf.usermodel.Picture;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public void m1 () throws FileNotFoundException, IOException{
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() ;
}Last edited by thehero; 03-13-2009 at 06:20 AM.
Similar Threads
-
[SOLVED] Apache Commons Properties file exceptions
By edwardmluk in forum Java ServletReplies: 1Last Post: 03-06-2009, 04:24 PM -
Reading a File
By zoom1017 in forum New To JavaReplies: 4Last Post: 02-20-2009, 03:04 AM -
Reading from csv file.plz help!!!!!!!!!!
By sanjayksaini in forum New To JavaReplies: 1Last Post: 12-19-2008, 07:41 AM -
Apache Axis2 is built on Apache AXIOM, a new high performance, pull-based XML object.
By anusoniaa in forum XMLReplies: 0Last Post: 11-15-2008, 07:29 AM -
Reading a file
By mew in forum New To JavaReplies: 2Last Post: 12-30-2007, 12:23 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks