How to open word file in rich text box with images and bullets

Posted by Mayankshri under C# on 2/14/2012 | Points: 10 | Views : 2320 | Status : [Member] | Replies : 2
I want to open a word file in rich text box .
i am using this code-

 Microsoft.Office.Interop.Word.ApplicationClass wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();
object File = txtfilepath.Text; //this is the path
// for open a word file in word document use this code
// Process.Start(File);
object nullobject = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application wordobject = new Microsoft.Office.Interop.Word.Application();
wordobject.DisplayAlerts = Microsoft.Office.Interop.Word.WdAlertLevel.wdAlertsNone;
Microsoft.Office.Interop.Word._Document docs = wordObject.Documents.Open(ref File, ref nullobject, ref nullobject, ref nullobject,
ref nullobject, ref nullobject, ref nullobject, ref nullobject,
ref nullobject, ref nullobject, ref nullobject, ref nullobject,
ref nullobject, ref nullobject, ref nullobject, ref nullobject);
docs.ActiveWindow.Selection.WholeStory();
docs.ActiveWindow.Selection.Copy();
IDataObject data = Clipboard.GetDataObject();
rtbgermanfile.Text = data.GetData(DataFormats.Text).ToString();
docs.Close(ref nullobject, ref nullobject, ref nullobject);
wordobject.Quit(ref nullobject, ref nullobject, ref nullobject);
//wordobject.Quit(SaveChanges:false, OriginalFormat: false, RouteDocument: false);
System.Runtime.InteropServices.Marshal.ReleaseComObject(wordobject);


It works fine but open only text. i want to open images and bullets also .

Thanks in Advance




Responses

Posted by: Naraayanan on: 2/14/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
well You can't show an Image in the Rich Text Box. Create your own control and use it.

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Mayankshri, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Mayankshri on: 2/14/2012 [Member] Starter | Points: 25

Up
0
Down
you know any idea about how to do this.

Mayankshri, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response