report explorer
which examples can i look at to see how the reportexplorer works?
I got multiple reports on a seperate form (which users can not see) and i
want the data like paper size to be customable, is that possible while using
the report explorer? I keep running into problems with different paper sizes
and I wanna get rid of those problems.
regards
Thomas Los
I got multiple reports on a seperate form (which users can not see) and i
want the data like paper size to be customable, is that possible while using
the report explorer? I keep running into problems with different paper sizes
and I wanna get rid of those problems.
regards
Thomas Los
This discussion has been closed.
Comments
I opted for a function re-scale the report before printing. After the user
has selected the print dialog, I determin the selected paper size and
re-scale the report accordingly. I designed all reports in A4, but they
print fine in Letter, A3 or any other given format because of this.
Here is an excerpt of the code that I use to do this:
procedure TReportHandler.ScaleReport(Sender: TObject);
var l: integer;
ARep: TppCustomReport;
begin
if not (Sender is TppCustomReport) then exit;
ARep := (Sender as TppCustomReport);
with ARep do begin
for l := 0 to BandCount - 1 do
ScaleChildsWidth(Bands[l], (PrinterSetup.PageDef.mmWidth /
InitialPaperWidth));
end;
end;
procedure TReportHandler.ScaleChildsWidth(AParent : TppBand; ScalePercent:
double);
var i : integer;
begin
if ScalePercent = 1 then exit;
for i := 0 to AParent.ObjectCount - 1 do begin
if (AParent.Objects[i] is TppSubReport) then begin
ScaleReport((AParent.Objects[i] as TppSubReport).Report);
end else if (AParent.Objects[i] is TppPrintable) then
with (AParent.Objects[i] as TppPrintable) do begin
Left := Left * ScalePercent;
Width := Width * ScalePercent;
Width := Width - ((Width / 100) * 5); // Subract 5% of the width
Top := Top * ScalePercent;
Height := Height * ScalePercent;
Font.Height := Round(Font.Height * ScalePercent);
end;
end;
end;
You don't need to scale the height of components, as they usally
expand/subtract automaticly when a page is printed to fit the page.
Hope that helps, Marco...
-------------------------------------------------------------------
Marco Heine
QUMAS
Enterprise Compliance Management
Visit our Website: www.qumas.com