package com.howto;
import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.hwpf.HWPFDocument;
/*
* Here we will learn how to read a Doc file
*/
public class ReadDocFile {
public static void main(String args[]) throws IOException {
/*
* Create input stream of the doc file - Provide exact path of the doc
* file to read
*/
FileInputStream fistream = new FileInputStream(
"File_Path");
HWPFDocument document = new HWPFDocument(fistream);
System.out.println("Length of docment is :"
+ document.characterLength());
System.out.println(document.getText());
System.out.println(document.getDocumentText());
}
}
Here we will use POI open source project to read windows doc file. PoI Jar will be required that can be downloaded from apache website.
its working or not..
Did you try this? What is the problem are you facing?
what if we want to embed this code in javascript ? how should we do it then ?
Short and simple..thank you very much