User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 428,064 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,463 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 1085 | Replies: 7
Reply
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Reading Document file

  #1  
May 14th, 2008
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
Accept Challenges and Enjoy Coding... :)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

  #2  
May 14th, 2008
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"/>
Accept Challenges and Enjoy Coding... :)
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

  #3  
May 16th, 2008
Originally Posted by sbv View Post
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 ?
Accept Challenges and Enjoy Coding... :)
Reply With Quote  
Join Date: May 2008
Posts: 2
Reputation: elegantkvc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
elegantkvc elegantkvc is offline Offline
Newbie Poster

Re: Reading Document file

  #4  
May 23rd, 2008
hi,

You have to use Interop.word to to avoid that COM exception.It will work surely.
cheers mate
vijay
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

  #5  
May 24th, 2008
hi
thank you very much for reply.
can you please elaborate your reply.

thanking you.
Accept Challenges and Enjoy Coding... :)
Reply With Quote  
Join Date: May 2008
Posts: 2
Reputation: elegantkvc is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
elegantkvc elegantkvc is offline Offline
Newbie Poster

Re: Reading Document file

  #6  
May 26th, 2008
hi,
Actually you have to use Office 2003 or Office 2007 to get the Interop word.
Cheers
vijay
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

  #7  
May 27th, 2008
ok. thanks. i will check it and let you know.
Accept Challenges and Enjoy Coding... :)
Reply With Quote  
Join Date: Jan 2008
Location: India
Posts: 160
Reputation: sbv is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

  #8  
May 30th, 2008
Hey its not working buddy. help me plz.
i want in detail information.
Accept Challenges and Enjoy Coding... :)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 12:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC