how to open word(microsoft word) to richtextbox in vb.net? i just know use vb.net to open word but cannot import to richtextbox
Printable View
how to open word(microsoft word) to richtextbox in vb.net? i just know use vb.net to open word but cannot import to richtextbox
A RichTextBox only can show plain text and RichText. A Word document is a word document, not a richtext document so you can't open a Word document inside of a RichTextBox unless you convert it to Rtf first.
If you are dead set on getting a word document to work in a richtextbox, you're probably going to have to create your own RichTextBox (inheriting the System.Windows.Forms.RichTextBox) and then read in the Word document, do your own parsing and convert it to Rtf. You won't be able to show all of the advanced features that way.
It's either that or you're creating your own TextBox from scratch and drawing everything. Again, you'd need to parse the Word Document.
How Word document convert it to Rtf?
Do a .SaveAs and pass the parameter rtf parameter.
VB Code:
'... '... oDoc.SaveAs(FileName:="C:\Test.rtf", FileFormat:=Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatRTF)
Well, you have two options. Save it as an Rtf from within Word (As RobDog's code does), or you do some heavy research into the Doc format and write your own parser to parse it and then save as an Rtf. The former is easy but the user has to have Word on their machine. The latter is very difficult but you wouldn't need Word.Quote:
Originally Posted by BradleyOng83
Since its a proprietary fileformat, I doubt you will be able to parse it without having Word installed on the system. So since you need Word, might as well take advantage of it. :)
It's proprietary but that doesn't mean Word has to be installed. No part of any Document is saved to the Word program, therefore the Word Document has everything needed. You just have to find a way to figure out what every part means with little to no documentation. You can build your own Parser.Quote:
Originally Posted by RobDog888
OpenOffice.org and KOffice both can read Word documents. They run on Linux so they definately don't require Word to be installed.
So while it is an option to parse a Word document and display it without Word, it's incredibly difficult. OpenOffice has tons and tons of developers in IBM, Sun, and regular OO developers. It's definitely a huge task for one person.
True, but thats why it wouldnt be a real solution as I wouldnt want to even try it. I dont have that kind of time left in my life. :)
Ps, you need to update your avatar from vBulletin 2.0 to 3.0 :D
Hey! It's a real solution :mad:Quote:
Originally Posted by RobDog888
Though it isn't practical at all.
But vBull 3 doesn't have an image. It's just text :confused:Quote:
Originally Posted by RobDog888
Though in my preferences I told it to reference the URL for the LogOut button and didn't upload it myself (or at least I thought I did).
why not use the dsoframer.ocx and use it's read/write doc files methods in conjunction with the richtextbox
microsoft word's interface is one big glorified richtextbox...
Is the "dsoframer.ocx" a third party control or a MS one? Also, is it free?
Quote:
Originally Posted by RobDog888
yes and yes
i'll upload it for ya here cause i dont have a link to it on MS's site
So I take it it's an MS control (the first question wasn't a yes or no so it's hard to tell what you were saying yes to)?Quote:
Originally Posted by JuggaloBrotha
If you check its properties you can see its "UNSUPPORTED BY MICROSOFT" and also signed by Microsoft. So its probably a Beta and/or free. I'll look if its still available as it was signed ~ a year ago.
Its True. but only supports Office 2000 and 2002 (XP).
Here is the link to it. Its a VC++ ocx for use in Visual Basic but doesnt say if its .NET or VB6. It does mention C# so maybe...
http://support.microsoft.com/default...b;en-us;311765