Changing fonts at runtime
Hi
I am using Delphi 6 and RB 9.03.
I cannot change the fonts on runtime.
I can change the size and style but not the font itself with the code below.
The report is created in Verdana, but some users want it in Arial.
Thans for your advice.
Andre
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject.HasFont
then begin
lObject.Font.Name := 'Arial';
lObject.font.size:=nSize;
lObject.Font.Style:=fStyle;
end;
end;
I am using Delphi 6 and RB 9.03.
I cannot change the fonts on runtime.
I can change the size and style but not the font itself with the code below.
The report is created in Verdana, but some users want it in Arial.
Thans for your advice.
Andre
for liBand := 0 to aReport.BandCount-1 do
for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
begin
lObject := aReport.Bands[liBand].Objects[liObject];
if lObject.HasFont
then begin
lObject.Font.Name := 'Arial';
lObject.font.size:=nSize;
lObject.Font.Style:=fStyle;
end;
end;
This discussion has been closed.
Comments
As a test I copied your code below exactly (changing "aReport" to ppReport1)
and placed it in the BeforePrint event of a test project. This successfully
changed all fonts in my report to Arial (from Wingdings). Where are you
calling this code from? If you trace this code, then perhaps trace the
OnGetText of a text component on your report, are you certain the font is
not changed? Are you loading templates? Try creating this with a minimal
example like I did and see if you can track down the problem.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I found it. I used a translation component to translate document. And for
some reason the component translates also the font names.
Brdgs
Andre