954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

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

Hi i am open a word file 2007(.doc file) in a rich text box through open dialog box.
It works fine but images and bullets are not shown in a rich text box.
i want to open open word file with images and bullets in a rich text box.

I am using this code for open a word file and convert it to sentence by sentence.

Microsoft.Office.Interop.Word.ApplicationClass wordObject = new Microsoft.Office.Interop.Word.ApplicationClass();
                object File = txtfilepath.Text; //this is the path
                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();
                string name = rtbgermanfile.Text.Trim();
                name = String.Join(Environment.NewLine, name.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries));
                string newtext = name.Replace("\n\n", "\n");
                string newtext2 = newtext.Replace("\n\n", "\n");
                rtbgermanfile.Text = newtext2.ToString();
                txtwriteingerman.Text = rtbgermanfile.Lines[0];
                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);


Thanks in Advance.

mayankshri
Newbie Poster
4 posts since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

try Google

java script of rtf get script and use it that will work i got same solution some months back

mani-hellboy
Junior Poster in Training
69 posts since Feb 2012
Reputation Points: 0
Solved Threads: 7
 

Hi guys,
I would like to know how the split function is working. The following is the problem and i want to solve it.

I am getting input from the user as 200*569+875-9632

the thing is i have to split the integer and perform the operation as above.

Any suggestions,

Thanks in advance.

vinoit
Newbie Poster
1 post since Feb 2012
Reputation Points: 10
Solved Threads: 0
 

Hi, vinoit.
Welcome to DaniWeb.
For your question, you will need to start a new thread.
On the main forum page near the bottom, there is a large button that says "Start New Thread".

thines01
Postaholic
Team Colleague
2,424 posts since Oct 2009
Reputation Points: 445
Solved Threads: 402
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You