hi..
I'm trying to read a .docx file using apache poi api methods.. But i'm facing a few problems..
Can anyone suggest me the changes to be made in this code??
package apiole;
import java.io.*;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
public class Apiole {
public static void main(String[] args) throws IOException {
File f = new File("D:\\vishal\\java_projects\\doc.docx");
InputStream in = new FileInputStream(f);
String test = extractText(in);
System.out.print("text: "+test);
}
public static String extractText(InputStream in) {
XWPFDocument doc = new XWPFDocument(in);
XWPFWordExtractor ex = new XWPFWordExtractor(doc);
String text = ex.getText();
return text;
}
}