hi..

to read a document file in Asp.Net and Vb.net as a Code behind , Use following Code

Sub Read(ByVal RPath As String)
        If RPath <> "" Then
            Dim WordApp As New Word.ApplicationClass
            Dim filepath = Server.MapPath("images\Resume\") & RPath
            Dim File As Object = filepath
            Dim nullobj As Object = System.Reflection.Missing.Value

            Dim doc As Word.Document = WordApp.Documents.Open(File, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj)

            Dim doc1 As Word.Document = WordApp.ActiveDocument

            Dim m_Content As String = doc1.Content.Text

            txtResume.Text = m_Content

        doc.Close(nullobj, nullobj, nullobj)
        End If
    End Sub

here in ResumePath send the file name to read.

Best Luck

in this u need to add reference. Do this as follows..
project by right clicking in
the solution explorer on References->Add Reference. Click on the COM
tab and look for the Microsoft Word 9.0 Object Library. Click Select
and OK.

And then add this line in web config file

<system.web>

          <identity impersonate="true"/>

in this u need to add reference. Do this as follows..
project by right clicking in
the solution explorer on References->Add Reference. Click on the COM
tab and look for the Microsoft Word 9.0 Object Library. Click Select
and OK.

And then add this line in web config file

<system.web>

          <identity impersonate="true"/>

Hi All,

But here is the problem when we use it on server. i get COM exception
is any other way to read Word File without third party control ?

hi,

You have to use Interop.word to to avoid that COM exception.It will work surely.
cheers mate
vijay

hi
thank you very much for reply.
can you please elaborate your reply.

thanking you.

hi,
Actually you have to use Office 2003 or Office 2007 to get the Interop word.
Cheers
vijay

ok. thanks. i will check it and let you know.

Hey its not working buddy. help me plz.
i want in detail information.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.