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

TppPrintPreview Problem Not Resolved

edited June 2002 in General
Hello:

None of your examples or the tip files seem to be applicable to my
problem. The problem is simply that with my version 5.0 of
ReportBuilder Enterprise everything works fine but with version 6.0 my
DefaultPreviewer logic has been broken where everything works except
the print button.

Again, here is the code I am using for 6.0:
-------------------------------------------
procedure TbfReport.OpenReport(Report: TppReport);
begin
Screen.Cursor := crHourGlass;
try
if ReportIsOpen then
Report.PrintToDevices
else
begin
DefaultPreviewer := TppPrintPreview.Create(Self);
DefaultPreviewer.Visible := False;
DefaultPreviewer.Parent := DefaultPreviewerPanel;
DefaultPreviewer.BorderStyle := bsNone;
DefaultPreviewer.Align := alClient;
DefaultPreviewer.Report := Report;
TppViewer(DefaultPreviewer.Viewer).ZoomSetting := zsPageWidth;
TppViewer(DefaultPreviewer.Viewer).Report := Report;
TppViewer(DefaultPreviewer.Viewer).ScreenDevice.Active := True;
if UpperCase(Report.PrinterSetup.DocumentName) = 'REPORT' then
Report.PrinterSetup.DocumentName := Self.Caption;
Report.PrintToDevices;
DefaultPreviewer.Visible := True;
ReportIsOpen := True;
end;
finally
Screen.Cursor := crDefault;
end;
end;

The above procedure is called in the form's onCreate event as:
OpenReport(ppReport1); I can send you an example application if you
would like. Here is the code from the 5.0 version:
...
begin
DefaultPreviewer := TppPrintPreview.Create(Self);
DefaultPreviewer.Visible := False;
DefaultPreviewer.Parent := DefaultPreviewerPanel;
DefaultPreviewer.BorderStyle := bsNone;
DefaultPreviewer.Align := alClient;
DefaultPreviewer.Report := Report;
DefaultPreviewer.spbPreviewClose.Visible := False;
DefaultPreviewer.spbPreviewWidth.Click;
TppViewer(DefaultPreviewer.Viewer).Report := Report;
if UpperCase(Report.PrinterSetup.DocumentName) = 'REPORT' then
Report.PrinterSetup.DocumentName := Self.Caption;
Report.PrintToDevices;
DefaultPreviewer.Visible := True;
ReportIsOpen := True;
end;
...

You will notice that most of the code is identical.

1) Please explain why the print button no longer works.

2) How can I resolve this problem?

Thanks, Sidney


On Wed, 26 Jun 2002 10:40:59 -0500, "Jim Bennett \(Digital

Comments

  • edited June 2002
    Here is the way to create the TppPrintPreview and have the print button
    work:

    uses
    ppPrvDlg;

    procedure TForm1.Button1Click(Sender: TObject);
    var
    lPreview: TppPrintPreview;
    begin

    lPreview := TppPrintPreview.Create(Self);
    lPreview.Report := ppReport1;
    lPreview.Visible := True;
    lPreview.Init;

    ppReport1.PrintToDevices;

    end;


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.