Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
I have a windows form application. i need to load word document in to rich text box using open file dialog. but please help me.
 
thank you
Posted 1-Aug-12 20:23pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You could try using the Micrsoft tools for office, but I don't know if they will convert a word doc to RTF ( of course, if htey do, a lot of formatting will be lost ). there are commercial Word editor components you can buy.
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 2-Aug-12 2:36am
   
You are right, but by saying "A" you could say "B": strictly speaking, one cannot. "Loading" with loss of information is not "loading", and loading into Word component is not loading into RichTextBox. So, formally, the answer is purely negative. (I voted "4".) --SA
Christian Graus at 2-Aug-12 2:48am
   
Well, that is true. I often try to move past what is asked, to answer what is intended. He clearly wants to edit a word doc, I doubt he NEEDS it to be in a rich text box.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

'add reference Microsoft Word 12.0 Object Library

'add imports
Imports System.Drawing
Imports System.Drawing.Image
Imports System.IO
Imports Microsoft.Office.Interop
Imports Word = Microsoft.Office.Interop.Word
Imports System.Runtime.InteropServices
 
'add richtextbox rtbDoc
'add button and include 

 Dim wd As New Word.Application
 
                With wd
                    .Documents.Open(OpenFileDialog1.FileName)
                    .Selection.WholeStory()
                    .Selection.Copy()
 
                    rtbDoc.Paste() 'RICHTEXTBOX

                    .Quit()
                End With
                wd = Nothing
 
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 690
1 Dnyaneshwar@Pune 540
2 ravikhoda 325
3 OriginalGriff 279
4 Manas Bhardwaj 230
0 Sergey Alexandrovich Kryukov 10,974
1 OriginalGriff 6,777
2 Peter Leow 4,785
3 Abhinav S 3,813
4 Maciej Los 3,575


Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid