Change Font for all textobjects when output goes to Excel.
Hi,
A customer uses a report to print/preview and also exports this report
to Excel. Headers and footers etc are hidden when creating a Excel
outputfile. This works fine.
Now he would like the font used when exporting to Excel to be Arial
Norrow 10pt for all text.
The report contains several subreports.
Can I iterate over all textobjects from RAP and change the font when
outputting to Excel?
Using D2007, RB14.08 and RAP.
--
Kind regards,
Jeroen Röttink
JR-soft software solutions
A customer uses a report to print/preview and also exports this report
to Excel. Headers and footers etc are hidden when creating a Excel
outputfile. This works fine.
Now he would like the font used when exporting to Excel to be Arial
Norrow 10pt for all text.
The report contains several subreports.
Can I iterate over all textobjects from RAP and change the font when
outputting to Excel?
Using D2007, RB14.08 and RAP.
--
Kind regards,
Jeroen Röttink
JR-soft software solutions
This discussion has been closed.
Comments
it to RAP. Problem seems that recursive code structures are not allowed.
Chicken-and-egg problem. Procedure doesn't compile because recursive
call can't be evaluated.
procedure UpdateReportFont(AReport: TppCustomReport);
var Component: TppComponent;
SubReport: TppSubReport;
X, Y: integer;
Band: TppBand;
begin
for X := 0 to AReport.BandCount-1
do begin
Band := AReport.Bands[X];
for Y := 0 to Band.ObjectCount-1
do begin
Component := Band.Objects[Y];
if (Component is TppCustomText)
then Component.Font.Name := 'Arial Narrow'
else if (Component is TppSubReport)
then begin
// recurse into subreport
SubReport := Component as TppSubReport;
UpdateReportFont(SubReport.Report); // <-- problem here
end;
end;
end;
end;
--
Kind regards,
Jeroen Röttink
JR-soft software solutions
TppCustomReport a parameter, to do it. Should only take a few minutes to
implement.