Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?

Have Programming Question? Ask it here!
 
 
 


kishor Rangadiya
I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?
1 Answer(s)      a year and 3 months ago
Posted in : Java Beginners


import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException;

public class ReadFileExample {

public static void main(String[] args) {

    BufferedReader objReader = null;

    try {
        String strCurrentLine;

        objReader = new BufferedReader(new FileReader("D:DukesDiary.txt"));

        while ((strCurrentLine = objReader.readLine()) != null) {

            System.out.println(strCurrentLine);
        }

    } catch (IOException e) {

        e.printStackTrace();

    } finally {

        try {
            if (objReader != null)
                objReader.close();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

}


Advertisement
View Answers

May 15, 2013 at 4:16 PM


hi friend,

Yes, your doubt is genuine this code may not read properly the doc or docx etc. (Microsoft Office suit file format) files. If you tried to read these files it would be seem like a corrupted file.

To know how to read doc file in java you can go through the link

http://www.roseindia.net/tutorial/java/poi/readDocFile.html

Thanks.



Related Tutorials/Questions & Answers:
 

 

 

DMCA.com