Reading doc file using streamreader

Posted by Bishal on Stack Overflow See other posts from Stack Overflow or by Bishal
Published on 2012-12-19T04:50:52Z Indexed on 2012/12/19 5:03 UTC
Read the original article Hit count: 163

Filed under:
|

I am trying to read .doc/.docx file with stream reader, but it give me output as unspecified character ie.

??[ ?L?f???C???.

I'm writing the file using a text editor. Here's a snippet of my code:

string filePath = baseUrl+ "Sample.docx";  
    using (StreamReader reader = new StreamReader(filePath, Encoding.UTF8))
    {
        txtBody.Text = reader.ReadToEnd();
    }

I'm using VS 2010. Thank you.

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET