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

different fonts on same line of report

Status
Not open for further replies.

muralinarayan1968

IS-IT--Management
May 13, 2012
18
IN
Hi,
I need to design & print a report wherin i need to change the font for some part of the text for eg:-
This is a test line in the report

I want "This is a" in say font kabel bd bt & test line in font times roman italic & in the report back to kabel bd bt

How do i achieve this at runtime assumin that the entire line This is a test line in the report as a single string or variable.

Regards
Murali Narayan
 
I still think you could use the single record for each field and have one of the VFP report controls be large enough to simulate the line spacing you need and simply mark it as Remove Line If Blank to shrink the detail band down for the rest of the controls and records when it is not needed.

Auguy
Sylvania/Toledo Ohio
 
Auguy,

I thought of suggesting something similar, but I was worried that it would be too complicated because of the number of different combinations of fields vs blank lines. But it might be worth keeping in mind.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
Mike / Auguy,
I really did not get this literally, how would you simulate line spacing???
Mike, i have concatenated all the fields into one big char field for the address which includes CR+LF within it & second variable for tel. no., so practically there are only 2 variables (m_addr_full & m_phon_full) i need to deal with, keeping this in mind can you give me some working eg. of what exactly you mean.

It's worth a try cause right now i am adding double cr+lf to the end of each line (double spacing) which takes up too much space incase the address is big, about 6 lines in all (double).

regards
murali
 
Murali,

As I mentioned earlier, I'm not familiar with FoxyPreviewer. But at a quick glance at the article you referenced, it would seem to meet your needs exactly.

You would still need the pre-processing to get rid of the emtpy lines, and still using a single field for the entire block of information. But you wouldn't need a separate field for the phone number. You would simply wrap the phone number in <b> tags to make it bold.

Note that the above comment is based only on a very quick reading of the article. You will need to satisfy yourself that it works before committing yourself.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips, training, consultancy
 
There are two solutions which leap to mind for me:

1) Prepare metric data in advance of your report for each line, determining the width of each field based on the font in use. Then, in your report, reference that metric data to insert appropriate SPACE(n) values in prefix of your text, that way they appear right by each other appropriately based on the string that is there. The VFP functions FONTMETRICS() are primitive for this purpose, but will work decently. To get completely accurate representations, write a little DLL that returns the font metrics for an explicit expression, and then with some mild experimenting, learn how much margin spacing / padding VFP uses.

2) Using the same basic principle above, open up the FRX file itself, locate the lines affected for the text items, and re-size them before printing each page. This way you're dynamically re-creating the form in such a way that the explicit metrics for each items coordinates are setup correctly and the form will print correctly with appropriate spacing.

Another way is to write a little DLL that uses the Win32 functions for generating a report, and manually populate the report in the same way. You will still need to compute things as in 1) with regards to string / expression font metrics, but you are also gain much freedom in what you can do on a report.


It's all a matter of how far down the rabbit hole you want to crawl.

Best regards,
Rick C. Hodgin
 
You can also try using the ReportListener object that was introduced with Visual FoxPro 9.0. It's fairly bare bones, in order to do more precise placement and flexible handling we defined our own class "AS ReportListener" inheriting the object and adding a number of additional tweaks and abilities to it. It's grown to over 160K but it can do virtually anything.

And to think that we first used it just so we could do one thing, put a watermark on our reports.
 
DbMark,
I really could not figure out what you have explained, i am using report listner for only 1 thing that is rotating a date field 90 deg.
I am fairly inexperienced in this regard, can you please elaborate with some samples, also the tweaks & abilities that you have mentioned.

regards
murali
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top