Click here to Skip to main content
12,884,771 members (31,578 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#3.0 C#
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
   
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 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  
Comments
Member 11557678 28-Mar-15 13:46pm
   
solution 3 is very good it really works fine.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 29 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100