Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 434
  • Last Modified:

RTF to TEXT in ActiveX dll.

What is a good way to convert a RTF document into plain text inside of an ActiveX VB Dll?

Thanks
Greg
0
RowdyOne078
Asked:
RowdyOne078
  • 2
  • 2
1 Solution
 
JMCrenshawCommented:
How complicatd is the RTF document. Does it make use of graphics, embedded images, tables etc.
0
 
RowdyOne078Author Commented:
it is a export from Crystal Reports 8.5 to RTF, so its wide open dependent on the reports.
0
 
Dang123Commented:
You could add a form with the RichTextBox control on it and do something like this

Add a form with a Rich Text Box Control to your DLL project

Set module level variables to them in your class module

Private frmRT                   As frmRichText
Private WithEvents RichTextBox1 As RichTextBox


Initialize them in your class initialize
   Set frmRT = New frmRichText      ' Setup reference to
   Set RichTextBox1 = frmWS.RichTextBox1   ' richtextbox control

Get rid of them in your class terminate

   Set RichTextBox1 = Nothing
   Unload frmRS
   Set frmRS = Nothing


Work with it like this
    RichTextBox1.LoadFile strRtfFileNameAndPath, rtfRTF
    RichTextBox1.SaveFile strTxtFileNameAndPath, rtfText


From here you would have the text in a file that you could read back into a string.
0
 
JMCrenshawCommented:
You could use the RichText control, however it doesn't support a lot of the advanced or newer RTF commands and if the Crystal ouput uses those commands such as table and collums they would be ignored but you would get the text from it.

To do that you would need to place the control on a form, the Open the RTF File and output the data from the input command to the control. Once in the control you can use the Text property of the control that will return just the text part of the RTF.

This is a crude and messy way but it doesn't require the purchase of a third part tool.

Another way would be to look at using Word as a DDE server or via API calls, but this would requre the user to have Word installed.

Why not use Crstyal to Export to text instead ?
0
 
RowdyOne078Author Commented:
Crystal 8.5 has problems with exporting to plain text.  It cuts off fields and data.

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now