Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to load a word document into RichTextbox

How to load a word document into RichTextbox

Scheduled Pinned Locked Moved Visual Basic
csharptutorialquestion
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scothykonma
    wrote on last edited by
    #1

    Hi I want to load a word document into RTF control in VB.Net.I used Loadfile()method, its load only richtextfiles into RTF.But i want to load only .doc files.Any idea...? Thanks in advance...

    C S 2 Replies Last reply
    0
    • S scothykonma

      Hi I want to load a word document into RTF control in VB.Net.I used Loadfile()method, its load only richtextfiles into RTF.But i want to load only .doc files.Any idea...? Thanks in advance...

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      You can't. You need Word on the machine you want to use to load the document, and then you can interact with Word, perhaps to convert the file to RTF and thus be able to load it. Or you can buy a third party control.

      Christian Graus Driven to the arms of OSX by Vista.

      I 1 Reply Last reply
      0
      • C Christian Graus

        You can't. You need Word on the machine you want to use to load the document, and then you can interact with Word, perhaps to convert the file to RTF and thus be able to load it. Or you can buy a third party control.

        Christian Graus Driven to the arms of OSX by Vista.

        I Offline
        I Offline
        indian143
        wrote on last edited by
        #3

        There is one 3rd party control called DSOFramer.cab from Microsoft only, you can load all office components in to it as excel, word etc. I guess it should be free from micro soft site, check with that. As it is developped by Microsoft it will work only on IE. If you want any more components similar to it, you can go for Aspose an Australian company product. But with aspose everything is good it is browser independent, but the problem is you have to define the template document and then fill the data by using code. You can define the template structure by using aspose code. Try with which you find convenient. Thanks, Aleem Mohammad.

        Thanks & Regards, Md. Abdul Aleem NIIT technologies

        1 Reply Last reply
        0
        • S scothykonma

          Hi I want to load a word document into RTF control in VB.Net.I used Loadfile()method, its load only richtextfiles into RTF.But i want to load only .doc files.Any idea...? Thanks in advance...

          S Offline
          S Offline
          scothykonma
          wrote on last edited by
          #4

          Hi All, I got solution to this...My code is, Imports System.IO Imports System.Runtime.InteropServices Dim FilePath As String Dim objWord As Object Dim objDoc As Object objWord = CreateObject("Word.Application") FilePath = ("C:\Documents and Settings\Administrator\Desktop\Resume2.doc") objDoc = objWord.Documents.Open(FilePath, , True, , , , , , , , , False) objDoc.Select() RTB.Text = objWord.Selection.Text objDoc.Close() objWord.Quit() It shows my .doc file into RTB.

          D 1 Reply Last reply
          0
          • S scothykonma

            Hi All, I got solution to this...My code is, Imports System.IO Imports System.Runtime.InteropServices Dim FilePath As String Dim objWord As Object Dim objDoc As Object objWord = CreateObject("Word.Application") FilePath = ("C:\Documents and Settings\Administrator\Desktop\Resume2.doc") objDoc = objWord.Documents.Open(FilePath, , True, , , , , , , , , False) objDoc.Select() RTB.Text = objWord.Selection.Text objDoc.Close() objWord.Quit() It shows my .doc file into RTB.

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            This works, but you lose all the formatting and bullet points. All you're getting is the unformatted text, nothing else.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups