How to load a word document into RichTextbox
-
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...
-
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...
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.
-
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.
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
-
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...
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.
-
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.
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