IT Community - Software Programming, Web Development and Technical Support

How to open a word and Pdf document in the rich text box using C#.net

This is a discussion on How to open a word and Pdf document in the rich text box using C#.net within the C# Programming forums, part of the Software Development category; Hi, I am trying to open a word document using c#.net.I am getting the error of Retreiving the ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C# Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 03-20-2007, 12:40 AM
Balasubramanian.S Balasubramanian.S is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 182
Balasubramanian.S is on a distinguished road
Default How to open a word and Pdf document in the rich text box using C#.net

Hi,

I am trying to open a word document using c#.net.I am getting the error of Retreiving the com class factory comaponent cls id 80070005. i have given full rights to asp.net in DCOM configuration file. But i am getting the same error. I can able to open a word document in C# windows application. But i am unable to open it in C#.net web application. This is the code to open a word document in C#. I have included the dll of Microsoft object 11.0 library.
can anyone tell about this error?

Word.Application obj_app = new Word.Application();
Word.Document obj_doc = new Word.Document();
object readOnly = false;
object isVisible = true;
object missing = System.Reflection.Missing.Value;
object filepath = "D:\\WorkArea\\S.Bala\\Player Project\\LoadText\\Files\\document1.doc"; //file to be read
obj_doc = obj_app.Documents.Open(ref filepath,
ref missing, ref readOnly,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref missing,
ref missing, ref missing, ref isVisible,
ref missing, ref missing, ref missing, ref missing);
obj_doc.Select();

//Response.Write(obj_app.Selection.FormattedText.Tex t);
richTextBox1.Text = obj_app.Selection.FormattedText.Text;

obj_doc.Close(ref missing, ref missing, ref missing);
obj_app.Quit(ref missing, ref missing, ref missing);
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Crack a password protected word document using C#? $enthil C# Programming 3 11-19-2007 11:33 PM
How do I check that text entered in a text form field is an integer? itbarota HTML, CSS and Javascript Coding Techniques 2 10-26-2007 12:25 AM
how to open and retrive text file(.txt)? una_noche Java Server Pages (JSP) 1 08-17-2007 03:27 AM
How to Encode a text and Decode it to get the original text using c# .Net? Archer C# Programming 1 07-21-2007 01:10 AM
How to convert a word document/text document/PDF file into an image file? kingmaker C# Programming 0 07-16-2007 11:23 PM


All times are GMT -7. The time now is 01:51 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0