0

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

2
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by sbv
0

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"/>
0

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 ?

1

hi,

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

0

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

thanking you.

0

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

0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.