Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I'm trying to read from a word file .. I don't know which jar file I missed :

I'm trying to read a word file .. but actually there is a problem it says that " The type org.apache.xmlbeans.XmlException cannot be resolved. It is indirectly referenced from required .class files " .. so can I know the problem ??

import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.xwpf.usermodel.XWPFDocument;


public class Read_File {


    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream("C:\\Users\\Desktop\\m.docx");
            org.apache.poi.xwpf.extractor.XWPFWordExtractor oleTextExtractor = new XWPFWordExtractor(new XWPFDocument(fis));
            System.out.print(oleTextExtractor.getText());            
        } catch (Exception e) {
                e.printStackTrace();
        }
    }

}
like image 788
Mevo Hafez Avatar asked Jan 27 '26 14:01

Mevo Hafez


1 Answers

I've faced the same problem before.Adding the xmlbeans-2.3.0.jar can fix this problem.You can download the jar from here

like image 97
Vignesh Vino Avatar answered Jan 29 '26 05:01

Vignesh Vino



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!