Solved

RTF to TEXT in ActiveX dll.

Posted on 2003-10-23
5
424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month3 days, 19 hours left to enroll

630 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