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

Multi Text Format in Report

Status
Not open for further replies.

AlastairOz

Technical User
Jul 27, 2010
81
0
0
AU
I would like to do the following:
If a memo field in a report starts with company name:
For the sake of anonymity I will use:

"My Company Name"
I would like to make the first letter of each of these words only appear in RED while the remaining text for each word and the rest of the memo field to be black.

I have started with this so far:
IIF(mline(cReport.introduction,1,0) = "My Company Name" ,DO SOMETHING HERE ,"")

Thats as far as I have got. Am I heading in the right direction?

Regards

Alastair
 
Alastair,

Unfortunately, there's really no practical way of doing that with native VFP report controls.

You will have to use a third-party text control. I suggest you take a look at the Microsoft Rich-Text Control, which comes with VFP. That will be able to achieve the desired result.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

Further question : If I'd content input into Rich-Text control, how I can get/put it into a report?

Freddy
 
Freddy,

Drop a Picture / OLE Bound control into the report. Set its Control Source Type to "Expression or variable name". Set its Control Source to the variable or field that holds your text.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 

Alistair, have you looked at the Dynamics tab of the Field Properties in the report writer in VFP9?

You might be able to accomplish your goal by using the Script button.

I only utilized the simple logical situations of if this, make it bold font, otherwise make it normal font.

People smarter than me probably know what to do.

Good Luck,
Josh
 
Mike,

Thanks for your tips. But since I saved all formatted content to a memo field, and I dropped a Picture/OLE Bound Control into a report and set its control source to the memo field, then only 'text content' with all rich-text code print out directly (no bold, italic,... effect). Anything I do wrong?

FYI, I'm using VFP6.

Freddy
 
Sorry, Freddy. My mistake. I should have read your question more closely.

Try this:

1. Save the text in an RTF document.

2. Add a General field to the cursor that drives the report. Add the RTF document to the General field (using APPEND GENERAL <field name> FROM <file name>).

3. In the OLE Bound control (in the report), set "Control Source Type" to "General Field Name". Set the control source to the name of the General field.

Come to think of it, it will work better if you save the text in a Microsoft Word document rather than an RTF file. The Word document can have whatever formatting you want. The report will then display the text of the document, with all the formatting intact - or, at least, as much of it as can fit within the space that you give to the OLE Control.

Give it a try.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike,

Thanks again for your patient and time.

Your advice is clear enough, but I was stuck with step 1 ("SAVE THE TEXT IN A RTF DOCUMENT")

You see, originally I'd an OLEControl to work around and I saved all formatted content to a field by (REPL ONERECORD.FIELDG WITH ...MAINFORM.OLERTF.TEXTRTF).

How can I save all formatted content to a RTF document?

Freddy

p.s. please excuse my ignorance on this issue because I did not get a chance to touch it for a long time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top