Convert Word document into a RichText Format document

Thread Solved

Join Date: Aug 2007
Posts: 55
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Convert Word document into a RichText Format document

 
0
  #1
Sep 3rd, 2007
Greetings folks,

I need to load a word document file into a RichTextBox component, It can't be done directly, so, I need first, convert it to a RichText Format File and then load it to the component. Any Ideas?

Thanks

Omar
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Convert Word document into a RichText Format document

 
0
  #2
Sep 4th, 2007
Hi,

Try this, I haven't been able to test it:

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim Oword As Object
  2. Dim Odoc As Object
  3.  
  4. Private Sub Command1_Click()
  5. Set Oword = CreateObject("Word.Application")
  6. Set Odoc = Oword.documents.open("C:\temp.doc")
  7. Odoc.SaveAs FileName:="c:\x.rtf", FileFormat:=wdFormatRTF
  8. Oword.quit
  9.  
  10. Me.RichTextBox1.FileName = "C:\x.rtf"
  11. End Sub
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 55
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Re: Convert Word document into a RichText Format document

 
0
  #3
Sep 8th, 2007
Thanks KB ,

But, now I can't make it work, the "wdFormatRTF" is a non recognized variable , I tried to look for other options, but I can't find any related (and relevant) info about those options on the "Word.Application" object, maybe you can show me how can I accomplish this. Thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 160
Reputation: kb.net is an unknown quantity at this point 
Solved Threads: 26
kb.net's Avatar
kb.net kb.net is offline Offline
Junior Poster

Re: Convert Word document into a RichText Format document

 
0
  #4
Sep 9th, 2007
Hi,
Just replace the wdFormatRTF with number 6 (this code is for VB6, if you are using different IDE please advise).

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim Oword As Object
  2. Dim Odoc As Object
  3.  
  4. Private Sub Command1_Click()
  5. Set Oword = CreateObject("Word.Application")
  6. Set Odoc = Oword.documents.open("C:\temp.doc")
  7. Odoc.SaveAs FileName:="c:\x.rtf", FileFormat:=6
  8. Oword.quit
  9. Me.RichTextBox1 = ""
  10. Me.RichTextBox1.FileName = "C:\x.rtf"
  11. End Sub
It is never about the number of languages you know, you either have the logic of programming or you don't ...

Some of the codes I post are collected from different sites during the past couple of years, so I would like to thank them for their help and for enabling me to help.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 55
Reputation: culebrin is an unknown quantity at this point 
Solved Threads: 1
culebrin culebrin is offline Offline
Junior Poster in Training

Re: Convert Word document into a RichText Format document

 
0
  #5
Sep 10th, 2007
Thanks man!!,

That worked great!!, now I'm trying with other formats, I'll post how i'm doing with it...
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1
Reputation: The Neophyte is an unknown quantity at this point 
Solved Threads: 0
The Neophyte The Neophyte is offline Offline
Newbie Poster

Re: Convert Word document into a RichText Format document

 
0
  #6
Jan 24th, 2009
ok i found this thread through google and im quite a novice at scripting but where exactly would i incert that bit of code you posted in my MS word documents code?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Convert Word document into a RichText Format document

 
0
  #7
Jan 24th, 2009
First, it's strongly frowned upon to post to threads that are more than three months old. Even if you have a question regarding an old thread, then you would start a new thread, and post a link to the old thread with your question. This will help to ensure that you get a warm and helpful welcome instead of the inevitable flaming that is sure to follow posting to old threads.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC