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;
    }
}

XWPFDocument doesn't exist.. Something like that..
I've included both scratchpad and ooxml archives in my project..

yes, file exists..
I got it! I need to import org.apache.poi.xwpf.usermodel.XWPFDocument
XWPFDocument class is defined in this.

This question has already been answered. Start a new discussion instead.