943,789 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 2908
  • ASP.NET RSS
May 14th, 2008
0

Reading Document file

Expand Post »
hi..

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

ASP.NET Syntax (Toggle Plain Text)
  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
Similar Threads
sbv
Reputation Points: 15
Solved Threads: 8
Junior Poster
sbv is offline Offline
178 posts
since Jan 2008
May 14th, 2008
0

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
ASP.NET Syntax (Toggle Plain Text)
  1. <system.web>
  2.  
  3. <identity impersonate="true"/>
sbv
Reputation Points: 15
Solved Threads: 8
Junior Poster
sbv is offline Offline
178 posts
since Jan 2008
May 16th, 2008
0

Re: Reading Document file

Click to Expand / Collapse  Quote originally posted by sbv ...
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
ASP.NET Syntax (Toggle Plain Text)
  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 ?
sbv
Reputation Points: 15
Solved Threads: 8
Junior Poster
sbv is offline Offline
178 posts
since Jan 2008
May 23rd, 2008
1

Re: Reading Document file

hi,

You have to use Interop.word to to avoid that COM exception.It will work surely.
cheers mate
vijay
Reputation Points: 11
Solved Threads: 0
Newbie Poster
elegantkvc is offline Offline
2 posts
since May 2008
May 24th, 2008
0

Re: Reading Document file

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

thanking you.
sbv
Reputation Points: 15
Solved Threads: 8
Junior Poster
sbv is offline Offline
178 posts
since Jan 2008
May 26th, 2008
0

Re: Reading Document file

hi,
Actually you have to use Office 2003 or Office 2007 to get the Interop word.
Cheers
vijay
Reputation Points: 11
Solved Threads: 0
Newbie Poster
elegantkvc is offline Offline
2 posts
since May 2008
May 27th, 2008
0

Re: Reading Document file

ok. thanks. i will check it and let you know.
sbv
Reputation Points: 15
Solved Threads: 8
Junior Poster
sbv is offline Offline
178 posts
since Jan 2008
May 30th, 2008
0

Re: Reading Document file

Hey its not working buddy. help me plz.
i want in detail information.
sbv
Reputation Points: 15
Solved Threads: 8
Junior Poster
sbv is offline Offline
178 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: pop up menu in asp.net 2005 with c# like yahoomail
Next Thread in ASP.NET Forum Timeline: Online data,css,js Security





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC