Solved

RTF to TEXT in ActiveX dll.

Posted on 2003-10-23
5
416 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

759 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now