473,414 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Load word file and html file into richtextbox

HI Guys
How to open a word file and HTML file (Without tags) into
richtextbox control.file is opening by this code but it is opening in
plaintext format but i want to open in word format

IDataObject Data1;
object nullobj,file;
WordApp=new Word.ApplicationClass();
nullobj=Missing.Value;
file =strFileName1;
WordDoc = WordApp.Documents.Open(ref file, ref nullobj, ref
nullobj, ref nullobj,ref nullobj, ref nullobj, ref nullobj, ref
nullobj,ref nullobj, ref nullobj, ref nullobj, ref nullobj,ref nullobj,
ref nullobj, ref nullobj,ref nullobj);
WordDoc.ActiveWindow.Selection.WholeStory();
WordDoc.ActiveWindow.Selection.Copy();
Data1= Clipboard.GetDataObject();
str= Data1.GetData(DataFormats.StringFormat).ToString() ;
richTextBox2.Text = str;
Console.WriteLine(str);
WordDoc.Close(ref nullobj, ref nullobj, ref nullobj);

pla somebody help me.

Twinkle

Aug 11 '06 #1
2 17158
"Twinkle" wrote:
How to open a word file and HTML file (Without tags) into
richtextbox control.file is opening by this code but it is opening in
plaintext format but i want to open in word format
I believe you need to make changes to the following lines in your code:

str= Data1.GetData(DataFormats.Rtf).ToString();
richTextBox2.Rtf = str;

--
Timm Martin
Mini-Tools
..NET Components and Windows Software
http://www.mini-tools.com

Aug 11 '06 #2
Hi there
Thank you lot for help me
Twinkle
Mini-Tools Timm wrote:
"Twinkle" wrote:
How to open a word file and HTML file (Without tags) into
richtextbox control.file is opening by this code but it is opening in
plaintext format but i want to open in word format

I believe you need to make changes to the following lines in your code:

str= Data1.GetData(DataFormats.Rtf).ToString();
richTextBox2.Rtf = str;

--
Timm Martin
Mini-Tools
.NET Components and Windows Software
http://www.mini-tools.com
Aug 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
5
by: alejandro lapeyre | last post by:
How can I load / parse an HTML file with .NET? Thanks! Best regards, Alejandro Lapeyre
1
by: Amit D.Shinde | last post by:
Can Microsoft Word Document(.Doc) be loaded in Rich Text Box. Or is there any other method to get preview of Microsoft Word Document in VB.NET Please Help me
9
by: Jay Kim | last post by:
Hi, We're implementing a Windows application using Visual Basic .NET. One of the key features we need to implement is that we should be able to get the accurate byte offset of user selected...
4
by: ksskumar | last post by:
Hi Friends, I am creating a application using C#. In that application I am using RichTextBox (System.Windows.Forms.RichTextBox). My query is how to create a file link in Rich text box. ...
2
by: Larry Cheung | last post by:
Hi, Is ther anyway I can present a html file on a win form? I have tried richtextbox. However, it can only accept text or richtext file format. I would like to use this feature to, for...
3
by: sss024 | last post by:
Word document viewing in RichTextBox control
1
by: thomasp | last post by:
Using VB2005 I am trying to display a .rft file in a richtextbox control. The file contains an table and some other text. The file opens without a problem in MS Word, but when I display it in the...
7
by: veer | last post by:
Hi! i am making a program in which i want to search a particular word in html file and if word found save it into excel file with html file name e.g i want to search a string "visual" in a.html...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.