Solved

RTF to TEXT in ActiveX dll.

Posted on 2003-10-23
5
420 Views
Last Modified: 2010-05-01
What is a good way to convert a RTF document into plain text inside of an ActiveX VB Dll?

Thanks
Greg
0
Comment
Question by:RowdyOne078
  • 2
  • 2
5 Comments
 

Expert Comment

by:JMCrenshaw
ID: 9609301
How complicatd is the RTF document. Does it make use of graphics, embedded images, tables etc.
0
 

Author Comment

by:RowdyOne078
ID: 9609311
it is a export from Crystal Reports 8.5 to RTF, so its wide open dependent on the reports.
0
 
LVL 9

Accepted Solution

by:
Dang123 earned 500 total points
ID: 9609463
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
 

Expert Comment

by:JMCrenshaw
ID: 9609501
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
 

Author Comment

by:RowdyOne078
ID: 9609636
Crystal 8.5 has problems with exporting to plain text.  It cuts off fields and data.

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Saving history changes to sub form 4 48
Macro Excel - Multiple If conditions 2 81
Automatic Email Reminder 4 58
Send outlook email from VBS Script 2 45
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question