Focal Point
Change font for first character of string in a DEFINE

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5141071892

September 04, 2008, 09:45 AM
Jay
Change font for first character of string in a DEFINE
Is there a way just to modify the font of a first character of a string in a DEFINE statement.


WebFocus 7.6.6
Oracle 10
Windows XP
September 04, 2008, 09:51 AM
Prarie
When you say modify - what do you want to do to it? If you want to change colors or styles this is done in the Stylesheet.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
I 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.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
This is a field in a report body - The user wants the first character of the field to be a different font.


WebFocus 7.6.6
Oracle 10
Windows XP
I'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.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
The CLASS attribute in the Focus stylesheet is the hook for applying CSS.

See Applying External Cascading Style Sheet Formatting.


- Jack Gross
WF through 8.1.05