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

RTF or HTML in report textbox

Status
Not open for further replies.

WIREMESH

Programmer
Mar 15, 2004
109
US
I have a form that currently displays text from a memo field. I plan to replace the VFP textbox control with a control that enables the user to change font sizes, font, etc. The format of the data will be html or rtf. On my VFP report form, how do I display this data?
 
It would help to have specifics about HOW you intend to allow RTF or HTML editing. If it's in an ActiveX control, you can embed that same control on a report.
 
Two solutions come to mind.

First, VFP comes with an ActiveX control called "Microsoft Rich Textbox Control". This lets the user edit and save text in RTF format, with full control over fonts, styles, colours, etc. But it's a bit of a pain to use. And it's up to you to provide the user interface for it - for example, buttons or menu options to enable the user to choose the formatting.

The other possibility is to use the WebBrowser control, which in effect puts a mini version of Internet Explorer on your form. Within that control, you set the document's AllowEdit property to .T., which lets the user edit the text. The control supports bold and italic through keyboard shortcuts, but for other formatting options, you would have to provide the functionality yourself. I tried to use this method once, but I gave up because I couldn't get it to work to my satisfaction.

There are no doubt other ActiveX controls on the market which will solve the problem.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
We put RTF functionality in our app using Mike's first method, and it works a treat. Just bear in mind that when the data is saved it will contain the RTF tags, so if you need to act on this data you may also need to hold the 'plain' text version in another field.

As regards HTML, we bought a control for that.

Neil

I like work. It fascinates me. I can sit and look at it for hours...
 
Hi,

There is also a HTML-Editor made by FredA and to be downloaded at the French VFP users group at: This file (the comments a.s.o) and is in French language, I have translated it into English in case you cannot work with the French version. In case you require I could post it here.
Just download the original version first and have a look if this is what you require.

Regards,

Jockey(2)
 
Dan stated "If it's in an ActiveX control, you can embed that same control on a report."

How can I accomplish this? I have a 3rd party active x control on my form that saves html to dbf /memo.

I want to display the formatted text in a text area on my VFP report form.
 
There are very few report controls. One of them is "Picture/OLE Bound Control". It's not only there to add pictures. If you change controlsource type to General field name and report with a cursor having a general field, your problem moves to creating the general fields OLE object out of the html/rtf text. That would be done by storing the memo content to a htm or rtf file and then adding that file to the general field.

Having the appropriate ActiveX control for RTF is not sufficient, if you ask me. The general field will need an OLE server, that must be part of an application associated with the file extension of the file you add to the General field, when using FROM filename. Dan might refer to using the DATA clause of APPEND GENERAL and providing the activex as CLASS.

Bye, Olaf.


 
I want to display the formatted text in a text area on my VFP report form.

I've never found a good way of doing that.

Rather than creating a VFP report, I have resorted to presenting the report in the form of a web page (and sometimes launching the page from within my application via the web browser control). This is not an ideal solution, but it does have the advantage of letting you format the text (and graphics) in almost any way you like. Plus, the user can easily zoom and resize the report, print preview it, print it, or save it to an external file.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top