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

Emailing Report Problem

edited October 2012 in General
Hi There

I am using Reportbuilder 14.07 Professional with Delphi 7. I have a
problem with the email using the default email client. If I show the
preview dialog and click the email button , it opens a new outlook email
and attaches itself correctly. If I close that email , returning to the
preview screen and click the email button again, a new outlook mail
message opens but this time with no attachment. Is this a known bug ?

Also, when the printer device is set to screen to show the preview and
you click print and the printer dialog comes up, the second time you
print the report the device automatically set to printer, seemingly by
the print dialog , and the preview no longer appears, so you have to
manually set the device type on the Initialization of parameters to
force the preview. Any reason and/or workaround for this ?

Regards
Oliver



--- posted by geoForum on http://www.newswhat.com

Comments

  • edited October 2012
    Hi Oliver,

    1. This is not a known issue and I was unable to recreate this behavior
    with a simple app on my machine. Using Delphi 7 and RB 14.07, I place a
    report and a button on a form and enabled the EmailSettings. Then from
    the preview, I was able to email the report via Outlook multiple times
    without any issues. Please either give me the steps I can take to
    reproduce this behavior or send a simple example in .zip format to
    support@digital-metaphors.com.

    2. I am a bit unclear about what you are doing. When you say you set
    the "Printer Device" to "Screen" are you using the Report.DeviceType
    property or PrinterSetup.PrinterName property? The Print Dialog does
    not alter the Report.DeviceType property, it has its own internal
    properties used.

    Please provide me with the steps I can take to reproduce this issue on
    my machine or send me an example and I'll take a look at it for you.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2012
    Hi Nico

    Thank you for your response. I have sent you an email with all the
    relevant details and sample code.

    I just created a new project with one form that includes a ppReport ,
    Button , checkbox and edit box. The form codes looks like this :

    unit Unit1;

    interface

    uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls,
    Forms,
    Dialogs, StdCtrls, ppParameter, ppComm, ppRelatv, ppProd, ppClass,
    ppReport, ppPrnabl, ppCtrls, ppBands, ppCache, ppDesignLayer;

    type
    TForm1 = class(TForm)
    ppReport1: TppReport;
    ppParameterList1: TppParameterList;
    Button1: TButton;
    ppDesignLayers1: TppDesignLayers;
    ppDesignLayer1: TppDesignLayer;
    ppHeaderBand1: TppHeaderBand;
    ppDetailBand1: TppDetailBand;
    ppFooterBand1: TppFooterBand;
    ppLabel1: TppLabel;
    Label1: TLabel;
    Edit1: TEdit;
    CheckBox1: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure ppReport1InitializeParameters(Sender: TObject;
    var aCancel: Boolean);
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    var
    Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    ppReport1.print;
    edit1.text := ppReport1.DeviceType;
    end;

    procedure TForm1.FormShow(Sender: TObject);
    begin
    edit1.text := ppReport1.DeviceType;
    end;

    procedure TForm1.ppReport1InitializeParameters(Sender: TObject;
    var aCancel: Boolean);
    begin
    if checkbox1.checked then begin
    if sender is TpPReport then begin
    with (sender as TppReport) do begin
    EmailSettings.Enabled := true;
    DeviceType := 'Screen';
    edit1.text := ppReport1.DeviceType;
    AllowPrinttoFile := true;

    end;
    end;
    end;
    end;

    end.

    If you tick the checkbox and preview the report , you can recreate the
    email problem. With the checkbox unticked, you can recreate the
    devicetype change when you preview and click print and then close the
    preview.

    Regards
    Oliver





    --- posted by geoForum on http://www.newswhat.com
  • edited November 2012
    Hi Nico

    I believe my setting the devicetype = 'Screen' on the
    initializeparameters event is causing the second email to fail, because
    Initializeparameters runs when you click the email button on print
    preview the second time round.

    If the report's devicetype could revert to it's original setting after
    printing or emailing (ie closing the printpreview) then I think my
    problem would be solved for both.



    --- posted by geoForum on http://www.newswhat.com
This discussion has been closed.