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

Printing to PDF with Report Explorer

edited May 2005 in End User
Hello !

I'm using TppReportExplorer connected to the database for report design
in my application. But only administrator can use ReportExplorer. Other
users are using set of my buttons ("Save to PDF", "Print", "Preview")
and im using small these calls:

for Print:
ppReportExplorer1.Print('MY_REPORT01', 0);

for Preview:
ppReportExplorer1.Open('MY_REPORT01', 0);

How can i use add "Save to PDF" option ?

Thanks in advance

P.S.: I'm new in Report Builder (using 9.01). Its a great:)

Comments

  • edited May 2005
    I already found a solution in other newsgroup (using
    Report.Template.OnLoadEnd event)


  • edited June 2005

    This code does what I want, brings up the PDF file in Acrobat Reader for
    preview...
    ____
    ppPDFReport.AllowPrintToFile := True;
    ppPDFReport.DeviceType := dtPDF;
    ppPDFReport.ShowPrintDialog := False;
    ppPDFReport.PDFSettings.OpenPDFFile := True;
    ppPDFReport.Print;
    ____


    Printing from the report Explorer, the following code does not work...when
    show print dialog is True,
    the dialog comes up, but the print to file check box is not checked and the
    device
    type is not set to PDF, when ShowPrintDialog := False the report goes
    directly to printer
    rather than Opening the PDF with the PDF Reader
    ______
    procedure TF_ReportsForm.LoadEndEvent(Sender: TObject);
    begin
    ppDesigner1.Report.AllowPrintToFile := True;
    ppDesigner1.Report.DeviceType := dtPDF;
    ppDesigner1.Report.ShowPrintDialog := True; // if set to False, report
    goes directly to printer
    ppDesigner1.Report.TextFileName :=
    F_MainForm.sPDFDirectory + '\' + sReport + '.PDF'; // this
    works
    ppDesigner1.Report.PDFSettings.OpenPDFFile := True;
    end;
    _____


  • edited June 2005

    The code for the TppReportExplorer.Print method looks like this:

    LoadReport(aReportName, aFolderId);

    FReport.DeviceType := dtPrinter;
    FReport.Print;


    Thus, your OnLoadEnd settings are being overridden.

    The TppReportExplorer.Print method is called by TppReportExplorerForm.Print.
    The TppReportExplorerForm can be replaced with a custom version of your own.
    For an example, check out RBuilder\Tutorials\Complete Applications\EndUser
    with Custom Explorer.

    The other alternative is to modify the source code to TppReportExplorer.



    --
    Nard Moseley
    Digital Metaphors Corporation
    http://www.digital-metaphors.com


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.