You are reading help file online using chmlib.com
|
Rave Reports Developer Guide Dynamically Changing Fonts |
Top Previous Next |
QUESTION How can I dynamically change a Font color, name, size or style?
SOLUTION Some report designs can have one or more fields that would be enhanced if the you could control the font attributes of those fields to emphasis them when a certain condition occurred. There are a couple of ways to do this in Rave Reports.
1) One choice would be to "mirror" different sections. Each section would probably look very similar and would contain Text or DataText components with the font attributes you want. These sections to be mirrored should be on a Global Page. One section could contain all your components with font attributes set as "Arial" "10 points" "Normal" "Black". Another section would also contain the same components with the font attributes set as "Arial" "10 points" "Bold" "Red".
2) Another choice is to use the FontMaster component and a Rave event . to control which FontMaster is used. First, drop several FontMaster components on a Global Page. Set one FontMaster name to "FontArial10NormalBlack" with the font attributes set as "Arial" "10 points" "Normal" "Black". Then set the other FontMaster name to "FontArial10BoldRed" with the font attributes set as "Arial" "10 points" "Bold" "Red". The following is an example of an event that will change the FontMirror property of a DataText component to point to the FontMaster you want based upon the contents of a DataField. This could be used in an OnBeforePrint or OnGetText event of your Text or DataText component(s).
{ Event for DataTextFishName.OnGetText } function DataTextFishName_OnGetText(Self: TRaveDataText; var Value: string); begin if UpperCase(BioLifeDVCategory.AsString) = 'SHARK' then Self.FontMirror := FontArial10BoldRed; else Self.FontMirror := FontArial10NormalBlack; end if; end OnGetText;
|
You are reading help file online using chmlib.com
|