Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Changing report font/color after previewing the report

edited October 2009 in General
Dear DM, i've made a custom preview form, with a TppViewer inside which
shows the report preview ; everything is ok, but now i've been requested to
let the user select the font and color of the text. So i've created a form
to select font and color, and am using this procedure to change them:

procedure AssignFontToReport(nome:string; colore:TColor; aReport:TppReport);
var liBand,liObject:integer; lObject:TppComponent;
begin
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:=name;
lObject.Font.color:=color;
end;
end;
end;

The question is: what's the correct way to change the font/color in the
previewer ? do i have to regenerate the report ?

The following instructions don't work:

AssignFontToReport('verdana',clRed,TppReport(MyPreviewer.Report));
MyPreviewer.Report.devicetype:=dtScreen;
MyPreviewer.Report.PrintToDevices;

the results are that font isn't changed and the font color is always changed
to a light grey.

Any suggestion?

Thanks
Alessandra

Comments

  • edited October 2009
    Please ignore my message, i've solved the problem by myself. It was only a
    my mistake in my procedure "AssignFontToReport".
This discussion has been closed.