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

How can I AddArchiveDevice for an Email output from the report viewer - RB10.04 D6.2

edited October 2006 in General
Hi

I am using TRSClientReport to generate archived reports and store them in my
app for audit pruposes. This works great for all sorts of printing/file
output but does not work for EMail.

I do this now

procedure TfrmReportViewer.clrMainPrintDialogClose(Sender: TObject);
begin
// Only do this for documents
if (clrMain.PrintDialog.ModalResult = mrOK) and FDocument then
AddArchiveDevice(clrMain,
TppPageRequest(clrMain.PrintDialog.PageRequest));
end;


Is there an event I can latch onto that will be fired by the email button
being pressed. It currently is set to produce a PDF attachment.

regards
ANdrew

Comments

  • edited October 2006
    Hi Andrew,

    There is currently no direct way to access the email button in the preview
    (this will be enhanced for the next release) however you can access the
    OnClick event using the ToolBar property of the TppPrintPreview. Something
    like the following...

    uses
    ppPrvDlg;

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);
    begin
    TppPrintPreview(ppReport1.PreviewForm).Toolbar.Items[1].OnClick :=
    EmailButtonClick;
    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Nico

    Thanks for that.

    I got the hook into the event but don't know how to get the pageRequest (or
    even if it is possible).

    AddArchiveDevice(clrMain, TppPageRequest(clrMain.PrintDialog.PageRequest));

    This works for the printdialog is there an equivalent for the email
    production???

    regards


  • edited October 2006
    Hi Andrew,

    I'm a bit unclear about what you are trying to do. Are you trying to email
    an archive file on the fly or are you trying to create an archive file in
    addition to sending an email?

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2006
    Nico

    I am trying to create an archive file from the email attachment generated
    when the user clicks the email button. I am not trying to send an archive
    file by email.

    You guided me a few weeeks ago into how to do this for a print and it works
    great. I just cannot see where to hook into the generation of the attachment
    becuase I use the PrintDialogClose event at the momment to setup the
    archiving and this works great. I just don't see how I hook into pagerequest
    for the email attach generate

    this is print dialog
    AddArchiveDevice(clrMain,TppPageRequest(clrMain.PrintDialog.PageRequest));

    thanks


  • edited November 2006
    Hi Andrew,

    Inside the OnClick event you should only have to connect an ArchiveDevice to
    the report and then calling SendMail will generate the PDF to send as well
    as the archive file. Something like the following worked for me.

    procedure TForm1.EmailButtonClick(Sender: TObject);
    var
    lArchiveDevice: TppArchiveDevice;
    begin

    lArchiveDevice := TppArchiveDevice.Create(ppReport1);
    lArchiveDevice.FileName := 'c:\myArchive.raf';
    lArchiveDevice.Publisher := ppReport1.Publisher;

    ppReport1.SendMail;

    end;

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.