I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?

I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?

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

}

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:

Ads