September 04, 2008, 11:39 AM
Darin LeeI think I understand your question - you want the first character of a string to appear in a different font/size than the rest of the string, right? There isn't a way to do this for a single field. There ARE ways to make it appear that way.
If the field is being displayed in a heading/footing, you'll have to break it into two separate fields suppose you have the field NAME/A20:
NAME1/A1=EDIT(NAME,'9');
NAME2/A19=SUBSTR(20,NAME,2,20,19,NAME2);
Then in your heading
HEADING
"<NAME1<+0><NAME2"
and in the stylesheet
TYPE=HEADING, LINE=1, ITEM=1, FONT=ARIAL,$
TYPE=HEADING, LINE=1, ITEM=2, FONT=COURIER,$
If you want this to appear in a column of a report, it will be a little trickier, but will still involve breaking the field up into two fields and squeezing them together to make it appear as if they are a single field - then you have to play with column headings to make them appear as if the two were a single column as well.
September 04, 2008, 12:36 PM
JayThis is a field in a report body - The user wants the first character of the field to be a different font.
September 04, 2008, 01:44 PM
Darin LeeI'm assuming that "field in a report body" means that it appears as its own column. Styling can only be applied to an object in a report, such as a line, field, text item, column, etc. and unfortunately not to partial contents of a column/field. So about the only option as I mentioned before is to break the field up. When that field happens to be a column, it's going to be hard to get things to line up properly to make it look good. Here's an examnple, but it still looks a little funny due to the horizontal spacing required by different fonts and the separate fields.
DEFINE FILE CAR
CAR1/A1=EDIT(CAR,'9');
CAR2/A19=SUBSTR(20,CAR,2,20,19,CAR2);
END
TABLE FILE CAR
PRINT
CAR1 AS ''
CAR2 AS 'CAR'
CAR
BY COUNTRY
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
TYPE=DATA,
COLUMN=N2,
FONT='TIMES NEW ROMAN',
STYLE=BOLD,
$
TYPE=DATA,
COLUMN=N3,
FONT='COURIER',
$
TYPE=REPORT,
COLUMN=N3,
POSITION=+0.000000,
$
ENDSTYLE
END
This won't look good for an HTML report, however. The gap between columns appears.
For an HTML-only report, you might try hardcoding the tags for font changes into the field itself like the following:
DEFINE FILE CAR
CAR1/A34='<B><I>'|EDIT(CAR,'9')|'</B></I>'|SUBSTR(20,CAR,2,20,19,'A19');
END
TABLE FILE CAR
PRINT
CAR1
CAR
BY COUNTRY
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=10,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
$
ENDSTYLE
END
If you could use this with a cascading stylesheet, you may be able to specify a different font using an HTML tag which could give you what you want.
Couple of suggestions, anyways. Good luck.
September 04, 2008, 01:57 PM
j.grossThe CLASS attribute in the Focus stylesheet is the hook for applying CSS.
See
Applying External Cascading Style Sheet Formatting.