Author |
Message |
Rajesh batchu

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
in my rich text box control i need to load the msword document file
my word document file contain
but it is accepting onely a text file
can any one help me
Visual Basic7
|
|
|
|
 |
DMan1

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
yes...use the scond parameter (filetype) when loading a doc/rtf file:
Me .RichTextBox1.LoadFile("C:\MyDoc.doc", RichTextBoxStreamType.RichText)
|
|
|
|
 |
Rajesh batchu

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
it is showing an exception of file format not valid
and my doc file contains tables if u have any idea plz tell me
|
|
|
|
 |
ahmedilyas

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
the RTB control will only load RTF files, not word documents - its a different format altogether for the RTB control. the RTB Control can load RichText documents or plaindocument/text
|
|
|
|
 |
Rajesh batchu

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
|
|
 |
spotty

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
Did you save you documents from works as rtf documents and NOT word doc files.
If they are not rtf files they will not work in the RichTextbox control.
|
|
|
|
 |
DMan1

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
If you save your word document as "Word 97-2003 & 6.0/95-RTF" it will save the file as an rtf file with a doc extension...this format will allow you to open the document in previous versions of word and in your rtb
Me.RichTextBox1.LoadFile("C:\TheDoc.doc", RichTextBoxStreamType.RichText)
|
|
|
|
 |
Rajesh batchu

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
thank you all for helping me
but in my project i need to brouse for a .doc files and lode that file in the richtextbox control
|
|
|
|
 |
ahmedilyas

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
as stated, it cannot be done. You could however use perhaps MS Word interop to get the text, then paste it into the richtextbox control however you may lose some features/layout etc... I'm not entirely sure. RTB Controls can only load RTF formats, not doc files regardless
|
|
|
|
 |
DMan1

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
| RTB Controls can only load RTF formats, not doc files regardless |
|
ahmed...if the word document file is saved in the specified format as I last indicated it will be saved with a doc extension AND an rtf compatible format...however you are correct in that it will not open a normal word document....I hope that is clear enough for you that you don't feel ot neccessary to correct my statment again!
|
|
|
|
 |
ahmedilyas

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
Dman - re read my passage please - regardless the "extension" you save it - it has to be an RTF format
|
|
|
|
 |
cgraus

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
Just to be clear here ( although this has already been said ) - the RTF control can read rich text format, NOT the Word format. You keep referring to .doc files, assuming you mean ANY Word document by this ( and that seems likely, not least because it explains why you're having trouble ), this does not work. There is no way to read a Word doc on a PC that doesn't have Word. If it does, you can use the interop assemblies to interact with Word.
|
|
|
|
 |
Karrar

|
Posted: Visual Basic General, in my richtext box i need to load a ms word document file content |
Top |
Hii
'You Can Use this Sample it works With Me
'Where OpenFile Is the name of OpenFileDialog
'and rtbTopic is the name of RTB
OpenFile.ShowDialog()
Dim SR As New IO.StreamReader(OpenFile.FileName)
rtbTopic.Text = SR.ReadToEnd
OpenFile.Reset()
'Note :and you can Refine the files showing in the Open File Dialog to Show the *.doc only files by the following Code Sample
OpenFileDialog.DefaultExt = "Document Files(*.doc)"
OpenFileDialog.Filter = "Document Files(*.doc)|*.doc|Text Files(*.txt)|*.txt|Rtf Files(*.rtf)|*.rtf|HTML Files(*.html)|*.html| AllFiles(*.*)|*.*"
I hope my code is usefull to you
Bye
|
|
|
|
 |
|