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!

Printing part of report variable in bold

Status
Not open for further replies.

jjjt

Technical User
Sep 15, 2002
34
GB
Hi,

I wonder if anybody can help. We have a customer database that stores the different parts of the customer address separately i.e. customer.add1, customer.add2, etc.. Sometimes some of the fields will be blank, so for formatting reasons, when we print the address on a report we concatenate the separate parts of the address into a single string, eradicating any fields where len = 0, store in a report variable and print the variable.

What we would like to do is set it up so that certain elements of the address print in bold i.e.

add1,
add2,
add3
add4

I know we could create an individual field on the report for each element of the address and format those individually, but because of the aforementioned formatting problems we don't want to do that.

Does anybody have any ideas? Any help is much appreciated.
 
I think the way you have to handle that is by having 2 fields, one on top the other. Use the "print when" option on the fields to determine which one to print.

One of the fields will be set to Bold, and the other will not.

This technique is used a lot for line shading.



Jim Osieczonek
Delta Business Group, LLC
 
In the example I have given, 'add3' should always be printed in bold, regardless of any conditions. My report variable is set up as follows:

iif(len(add1)>0,add1,"") + iif(len(add2)>0,add2,"") + ...

Really what I need is a function that will convert a string to bold - let's call it STRBOLD() - so that I could set my report variable up as follows:

iif(len(add1)>0,add1,"") + iif(len(add2)>0,(add2),"") + iif(len(add3)>0,STRBOLD(add3),"") + ...

I know that if we used individual fields on the report we could check the 'Remove Line If Blank' constraint. The problem with this is that we have other fields adjacent to the address which do contain data. The result of this is, quite naturally, that the line is not removed and the blank remains in the address.
 
Since you are concatenating the strings together, it certainly makes it much more challenging. I know of a way you can do it, but I don't really like it and it will take a little work on your part to figure out the commands.

Most printers have some sort of Printer Control Language. This allows you to programmatically send commands to the printer. If you look in your printer manual, you should be able to locate the PCL commands to turn bold on, and the ones to turn bold off. Then you will need to modify your IIF statement to include these (called) escape codes.

Example:
iif(len(add1)>0,add1,"") + iif(len(add2)>0,(add2),"") + iif(len(add3)>0,"->boldcodeshere"+STRBOLD(add3)+"->noboldcodeshere","")

Notice I added code immediately before and after address3. If you look at the manual, the PCL codes "->" will make more sense.

Again, I'm not saying this is pretty, but it should work.


Jim Osieczonek
Delta Business Group, LLC
 
Since there's no way for the Report Designer to bold a portion of a field your solution will almost certainly involve separate fields.

I'd create 4 fields, line1, line2, line3, line4 and fill them in "top-down" with non-empty address lines. Set a switch to indicate which field contains add3. Then, as jimoo suggests, insert into the report 2 versions of each field, one on top of the other. The value of your switch will determine ("Print when") whether the bold or regular version of each field is printed.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top