Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Un-code RTF text ?

Status
Not open for further replies.

wilfranz

Technical User
Oct 4, 2003
122
US
Hello friends,

Is there a Function or Property available to directly read plain, de-formatted text from a memo field which contains RTF-formatted text?

I need to be able to access, from one app to another, the plain text contained in RTF memo fields (i.e. no RTF codes). Since the incoming text is not going to be used at all by RTF, it isn't getting bound to an oleRtfControl... and therefore the oleControl.Text property (which I know does strip out the code) is not available. Is there a direct method by which I can do this (i.e. something more direct than either adding a temporary, intermediate RTF control or building a parser)? E.g. a DLL function etc.

TIA
 
Hi wilfranz,

Can you just use RTF ActiveX itself? I mean like this:

oRich = CreateObject('RichText.RichTextCtrl.1')
oRich.defTextRTF = myMemoField
?oRich.Text


-- AirCon --
 
Hi AirCon,

Thanks for your prompt reply. I think what you are saying is what I'm looking for. But I am embarrassed to say that I don't understand the code references, and when I attempt to run your code example, I get an error. (I'm a newbie and thus far I have done all control manipulation visually. Setting up classes by code is still pretty mysterious to me.)

In particular:

1) oRich = CreateObject('RichText.RichTextCtrl.1')
What is the "RichText.RichTextCtrl.1" reference. I don't recognize it as the class name of the olecontrol I am using, which seems to want to be called "oleControl"

2) oRich.defTextRTF = myMemoField
Is ".defTextRtf" a property of the RTF control? I have been using .TextRTF and .Text, and don't find the .defTextRTF in the documentation.

Thanks very much for your help and patience,



 
If there are a limited and known set of tags, you could remove them with strtran().

Brian
 
wilfranz,

There is no need to be embarrassed, really! I also know this because of the good help from Intellisense :)
Are you using VFP6 or earlier ?

1. "RichText.RichTextCtrl.1" is the ClassName for RichText ActiveX. It is the ClassName in windows registry. OLEControl is VFP OLE container control. You can insert an ActiveX/OLE through this container.

If you are using OLEControl, go to the properties window and look for the property name "OleClass". That is the real ClassName for the ActiveX itself. Then you can use that name via "CreateObject()" directly

2. Yes it is a property for RichText Control. You can't find in the documentation (Help) because the documentation is still reflect to the old version (RichText version 2 or earlier). This property is from RichEdit control version 3.0

I hope you can understand what I said, because my english is not good.

Regards

-- AirCon --
 
Ahh.. I missed your question.

What is the error exactly ?

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top