Reading Document file

Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Reading Document file

 
0
  #1
May 14th, 2008
hi..

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

  1. Sub Read(ByVal RPath As String)
  2. If RPath <> "" Then
  3. Dim WordApp As New Word.ApplicationClass
  4. Dim filepath = Server.MapPath("images\Resume\") & RPath
  5. Dim File As Object = filepath
  6. Dim nullobj As Object = System.Reflection.Missing.Value
  7.  
  8. Dim doc As Word.Document = WordApp.Documents.Open(File, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj, nullobj)
  9.  
  10. Dim doc1 As Word.Document = WordApp.ActiveDocument
  11.  
  12. Dim m_Content As String = doc1.Content.Text
  13.  
  14. txtResume.Text = m_Content
  15.  
  16. doc.Close(nullobj, nullobj, nullobj)
  17. End If
  18. End Sub
  19.  

here in ResumePath send the file name to read.

Best Luck
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

 
0
  #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
  1. <system.web>
  2.  
  3. <identity impersonate="true"/>
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

 
0
  #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
  1. <system.web>
  2.  
  3. <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 Quick reply to this message  
Join Date: May 2008
Posts: 2
Reputation: elegantkvc is an unknown quantity at this point 
Solved Threads: 0
elegantkvc elegantkvc is offline Offline
Newbie Poster

Re: Reading Document file

 
1
  #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 Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

 
0
  #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 Quick reply to this message  
Join Date: May 2008
Posts: 2
Reputation: elegantkvc is an unknown quantity at this point 
Solved Threads: 0
elegantkvc elegantkvc is offline Offline
Newbie Poster

Re: Reading Document file

 
0
  #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 Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

 
0
  #7
May 27th, 2008
ok. thanks. i will check it and let you know.
Accept Challenges and Enjoy Coding... :)
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 178
Reputation: sbv is an unknown quantity at this point 
Solved Threads: 8
sbv's Avatar
sbv sbv is offline Offline
Junior Poster

Re: Reading Document file

 
0
  #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 Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC