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

Email button does not show in print preview

edited May 2013 in General
Hi

I have many reports in my application and have a generic initialisation
routine that sets most of the email / pdf etc setting up the same for
all reports by default. However, I have one report that refuses to show
the email button in print preview. Is there another setting (apart from
Report.EmailSettings.Enabled) that can effect the visibility of this
button?

I have checked that the EmailSettings.Enabled is set to true by putting
in a breakpoint immediately before printing the report and checking the
value.

I am running delphi XE with reportbuilder 12.05 build 251

Many thanks

Steve Everington

Comments

  • edited May 2013
    Hi Steve,

    Are you loading templates? If so, you need to be sure to either save
    the template down with the Email feature enabled or set the property
    after you load the file.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2013
    Hi Nico,

    Thanks for the reply. Some of my reports use templates, some don't but
    eitherway all my default settings are set after the template has been
    loaded:-

    //Code to attempt load template from database
    //In this particular case, report template is NOT loaded

    with TheReport do
    begin
    //Set defaults for all reports
    PDFSettings.Author := CurrentSession.User.FullName;
    PDFSettings.Title := RepTitle;
    PDFSettings.Creator := CurrentSession.User.FullName;
    PDFSettings.Subject := RepTitle;
    EmailSettings.FileName := RepTitle;
    AllowPrintToArchive := True;
    AllowPrintToFile := True;
    OutlineSettings.Enabled := true;
    OutlineSettings.Visible := true;
    PreviewFormSettings.WindowState := wsMaximized;
    PreviewFormSettings.ZoomPercentage := 100;
    PreviewFormSettings.ZoomSetting := zs100Percent;
    NoDataBehaviors := [ndMessageOnPage, ndBlankReport];
    DefaultFileDeviceType := 'PDF';
    PrinterSetup.DocumentName := RepTitle;
    try
    if CurrentSession.Parameters.EmailType = emSMTP then
    begin
    if DataModule1.SMTP.Host = '' then //if no host, not configured,
    so disable emailing
    Result := False
    else
    begin
    EmailSettings.UserName := RegFunc.ReadRegString('SMTP User');
    EmailSettings.Password := RegFunc.ReadRegString('SMTP
    Password');
    EmailSettings.HostAddress := RegFunc.ReadRegString('SMTP Host');
    // TppSMTPIndy(TheReport.Email).IndySMTP.Port := StrToInt
    (RegFunc.ReadRegString('SMTP Port'));
    EmailSettings.PreviewInEmailClient := False; //No 'Client' for
    SMTP
    Emailsettings.ShowEmailDialog := True; //Use built in dialog
    instead
    EmailSettings.FromName := CurrentSession.User.FullName;
    EmailSettings.FromAddress :=
    CurrentSession.User.Email.CurrentValue;
    Result := true;
    end;
    end
    else
    begin
    MAPIModule := LoadLibrary(PChar(MAPIDLL));
    try
    if MAPIModule = 0 then
    //No MAPI client installed
    Result := False
    else
    Result := True;
    EmailSettings.UserName := '';
    EmailSettings.PreviewInEmailClient := True; // Use MAPI client
    to preview email
    Emailsettings.ShowEmailDialog := False; //Don't use
    ReportBuilder's dialog
    finally
    FreeLibrary(MAPIModule);
    end;
    end
    except on E: Exception do
    Result := False
    end;
    if Result then
    begin
    EmailSettings.Subject := RepTitle;
    EmailSettings.Enabled := True;
    end
    else
    EmailSettings.Enabled := False;
    end;

    I have confirmed that EmailSettings is set to Enabled after this code
    has run, but I still cannot set the email button in PrintPreview.

    Thanks

    Steve Everington
  • edited May 2013
    Hi Steve,

    Sorry, I just did a search of our source and it looks like we added a
    check to see if the report contains groups with the
    GroupFileSettings.EmailFile property set to true.

    The TppEmail object does not support emailing individual groups, this is
    handled by the file device when the report is printed. If you would
    like to email the entire report, you will need to set the EmailFile
    property to False and the button will re-appear.

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited May 2013
    Hi Nico,

    Thanks, that sorted it out - must have set the flag whilst 'playing
    around' with emailing one day!

    Regards

    Steve Everington

    In article <51962945@mail.>, support@digital-metaphors.com says...
This discussion has been closed.