Displaying a Word document into a RitchTextBox

I was trying to display a Word Document into my RitchTextBox but i cant find the correct method to do it.. it work..but it dont keep the correcte format..its all screwup..

Try
                Dim FichierCV As String = dsEmp.Tables("Options").Rows(0).Item("opt_cv") & "\" & .Item("emp_cv")
                ViewCV.LoadFile(FichierCV, RichTextBoxStreamType.PlainText)
            Catch ex As Exception
            End Try


thanx


Answer this question

Displaying a Word document into a RitchTextBox

  • Sean Michael Murphy

    I cant find any control for doing  that.. anyone have a site where i cant get a word control displayer for  a window form  !!


    thanx.

  • pdressler

    Correct, that will not work.  Word format and RTF are different.  You would need to save all of your word docs to RTF (doing this, each newly created RTF file will take up 5 times the space as the word doc).

    An alternative is the broswer COM control, which you can add to a windows form and use file://xxxxxxxx.doc to load a word doc into your form.

    There are probably 3rd party components that would have a control that loads word docs into a windows form, but the base RTF control is not the best solution.  It will never look exactly like the original Word document.

  • Terry Rueter

    What our fried above is telling you to do is use the Webbrowser control that is installed as a com component on all windows computers (I think).

    The webbrowser control is the same display mechanism that Internet Explorer uses. 

    Notice that IE can open all sort of documents - pdf, rtf, word docs etc. - You don't need any third party control. MS let you use their browser control.

    What I would suggest is using google to search for the webbrowser control (note spelling).

    I think its COM name is SHDocVw.dll as I recall. This should get you started - 

    http://www.codeproject.com/csharp/webbrowser.asp

    Hope that helps

  • Displaying a Word document into a RitchTextBox