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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Rich Text Object 1

Status
Not open for further replies.

fmoore0001

Programmer
Dec 3, 2002
192
US
I am still using Visual Foxpro 6.0 (SP5) soon to 7.0 then 8 after the daredevils have debugged it for me ;-D

The MS Rich Text Object in Visual Foxpro 6.0 was very incomplete as I wanted to write documents in RTF in Word then be able to load, manipulate and print them in our program, but many RTF commands were missing from 6.0. Has this been corrected in 7.0 or 8.0?

rank
 
fmoore0001

VFP 7 uses the same OCX as VFP6.0. But why not automate Word instead? A lot more control available. Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
mgagnon (Programmer)

VFP 7 uses the same OCX as VFP6.0. But why not automate Word instead? A lot more control available.


Yes, Mike, unless (s)he is writing program for an unknown customer with unknown system settings and so on. And the target machine might not have Word installed, or not the right version of Word.

On the other hand - yes, Mike is right: it's the same RichEd32.OCX.

I also use it in my programs, so if you have some specific questions, fmoore0001, you are welcome to ask and I will try to answer them.

Regards,

Ilya
 
Just to clarify. VFP has nothing to do with what is available in the Rich Text Object.

It is a dll shared by a large number of MS products. There is no reason to expect it to be updated with a new version of vfp, in fact it is most likely to be updated with a new version of Office.



 
Ilya, you are absolutely write, I cannot depend that my clients have Word specifically available. I wanted to use the Rich Text objects to be available to print Rich Text Format (RTF) independent of anyone's setup.

My original goal was to be able to load a small (1-7 page) RTF document into a Visual Foxpro variable, do a 'find and replace' in the variable to change text in a specific format, say, for the text <<customer.name>> (note the double '<<>>' replace <<customer.name>> with customer.name, easy for me to develop documents, easy for clients to do replacement.

However, I have found that the Microsoft RTF objects are missing a LOT of the language, for what reason I do not know as I not have a total list of what the object actually understands (unless MS put one out). I know RTF commands like PAGE do not work. It is a real bummer.

So, I was wondering if MS ever made a real RTF ocx, or if one is commercially avaiable.

Frank
 
Frank,
I've used the MS 6.0 RTF control with great success, with one exception. Fox does not directly support RTF controls in their report forms, otherwise your problem would be solved. I have seen an article in FoxPro Advisor some time ago though about transporting your RTF information to things like Word, PDF, etc., though it did not solve my problems becuase I'm using other objects that are not RTF, and the two just don't mix well. You might want to check it out, I believe you can find the article on line at and do a search in their FoxPro magazine section.

Best Regards,
Scott

&quot;Everything should be made as simple as possible, and no simpler.&quot;[hammer]
 
fmoore0001 (Programmer):

My original goal was to be able to load a small (1-7 page) RTF document into a Visual Foxpro variable, do a 'find and replace' in the variable to change text in a specific format, say, for the text <<customer.name>> (note the double '<<>>' replace <<customer.name>> with customer.name, easy for me to develop documents, easy for clients to do replacement.


RTF control has two properties, Text (just plain ASCII text) and TextRTF. Changes in the first also changes the second (but you will lose formatting [sad] and have to do it on your own in code if you need it [sad][sad]).

But, essentially, you can load your RTF doc into RTF box and do like
Code:
STRTRAN(THISFORM.txtRTF.Text, ;
        &quot;<<Customer.Name>>&quot;, ;
        ALLTRIM(CUSTOMER.Name))
or simethng along these lines.


However, I have found that the Microsoft RTF objects are missing a LOT of the language

I do not exactly understand what you mean saying &quot;language&quot;, but if you are talking about the properties and methods/events - open the form in the Form Designer, bring up Properties window for your RTF box, select the tab All and see what's there.

You can also use the accompanying the MS Visual Studio 6 MSDN Help to find the &quot;RichTextBox Control&quot; article - never mind it's written for VB.

I hope this will help. [smile]

Regards,

Ilya
 
Ilya, thanks, it was as I feared. MS does not have, or want, a fully supported RTF object. Why would I need Word if I have that ;-)

Now, the question is, does somebody else have an OCX object that does? I have puzzled out ones for Visual Foxpro that were intended for Visual basic and the like, so I am sure if SOMEONE makes an RTF OCX I can use it.

Frank
 
fmoore0001

Why would I need Word if I have that

I'm starting to regret suggesting that to you.

Ilya, you are absolutely write, I cannot depend that my clients have Word specifically available.

Unlike some other programmers, I make a point of knowing exactly what my client has and doesn't have as additional software on their system. And if they do not have a Word processing sofware, I advise them of the the limitations of that situation, but I certainely do not try to create magic with flaky and limited OCX controls.
Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike, every situation is indeed different. I have a commerically sold product called Lien Writer(tm) ( ) and, of thousands, I swear I do not have two clients with the same computer setup.

Everything I have written for the program I have tried to design for absolute independence on every aspect of the program. That is why a real RTF OCX / Library would be a great tool. I may have found one in this TE Developers kit. They tell me I can pass a variable stored with a RTF page and it will convert and print it without problem.

Anyone tried it?

Frank
 
Mike, thanks, I will check out this Text Control OCX an report back. If you think about it, the ability to write some types of reports or form letters in RTF, then use Foxpro to replace the variables with new text (RTF needs only to have replace the text in the Rich Text Document replaced so long as the formatting commands are not touched!) could be a very powerful tool.

Frank
 
fmoore0001

Mike, thanks, I will check out this Text Control OCX an report back. If you think about it, the ability to write some types of reports or form letters in RTF, then use Foxpro to replace the variables with new text (RTF needs only to have replace the text in the Rich Text Document replaced so long as the formatting commands are not touched!) could be a very powerful tool.

Yes, it would be. But as you realized, VFP (being a data-centric application) cannot do it all. So we need third-party tools to achieve that and since VFP is not designed to create &quot;fancy&quot; looking reports, there are many tolls available out there, Word being one of them, Crystal report (where the OCX are freely re-distributable), RTF controls, FoxFire, Adobe Acrobat etc... Its just a matter of you finding the one taht will suit you best.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top