DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   ASP.NET (http://www.daniweb.com/forums/forum18.html)
-   -   Reading Document file (http://www.daniweb.com/forums/thread124134.html)

sbv May 14th, 2008 2:40 am
Reading Document file
 
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

sbv May 14th, 2008 2:42 am
Re: Reading Document file
 
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"/>

sbv May 16th, 2008 2:36 am
Re: Reading Document file
 
Quote:

Originally Posted by sbv (Post 606442)
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 ?

elegantkvc May 23rd, 2008 8:58 am
Re: Reading Document file
 
hi,

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

sbv May 24th, 2008 4:22 am
Re: Reading Document file
 
hi
thank you very much for reply.
can you please elaborate your reply.

thanking you.

elegantkvc May 26th, 2008 1:48 am
Re: Reading Document file
 
hi,
Actually you have to use Office 2003 or Office 2007 to get the Interop word.
Cheers
vijay

sbv May 27th, 2008 6:07 am
Re: Reading Document file
 
ok. thanks. i will check it and let you know.

sbv May 30th, 2008 1:39 am
Re: Reading Document file
 
Hey its not working buddy. help me plz.
i want in detail information.


All times are GMT -4. The time now is 5:57 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC