Home General

custom ppCustomPDlg form

edited December 2010 in General
I have created a copy of ppCustomPDlg so I could create a CanPrintToXLS
property that way I can have some reports that can print to XLS and some
that can not. I ran into an issue. When trying to email a report by
clicking on the email button the SetCanPrintToXLS routine creates an
exception and the email is never generated. Any thought or ideas, I'm not
doing anything special in the routine.

...
private
FCanPrintToXLS: Boolean;
procedure SetCanPrintToXLS(Value: Boolean);
...
public
property CanPrintToXLS: Boolean read FCanPrintToXLS write
SetCanPrintToXLS;
...
procedure TppCC4PrintDialog.SetCanPrintToXLS(Value: Boolean);
begin

if (Value <> FCanPrintToXLS) then // Exception happens here
begin
FCanPrintToXLS := Value;
end;

end;

I am running RB 12.03 and D2007.

BTW printing and exporting to PDF work fine, only happens when I try to
email.

Thanks in advance,
Rodger Van Kirk

Comments

  • edited December 2010
    Hi Rodger,

    I do not see anything in your code that would be causing an exception.
    Perhaps try tracing backward to the routine that calls SetCanPrintToXLS and
    see if perhaps the issue occurs before. Another thing to try would be to
    comment out all the code in the SetCanPrintToXLS and see if this routine is
    actually causing the problem.


    Regards,

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

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2010
    I commented out all the code in the SetCanPrintToXLS and everything worked
    fine.

    Here is how I set it for my different reports. I basically set it to true
    if the report is allowed to set to XLS and false if it can not.

    procedure TfrmHistory.rptHistory2PrintDialogCreate(Sender: TObject);
    begin

    TppCC4PrintDialog(rptHistory2.PrintDialog).CanPrintToXLS := False;

    end;

    Thanks in advance,
    Rodger Van Kirk


  • edited December 2010
    Hi Rodger,

    Thanks for the info. It turns out the PrintDialog is nil when an email is
    sent but the OnPrintDialogCreate was still being fired. I created a patch
    that fixes this issue. Send an email to support@digital-metaphors.com if
    you would like the patch.



    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
    "Rodger Van Kirk" wrote in message news:4d0a3cd2$1@mail....

    I commented out all the code in the SetCanPrintToXLS and everything worked
    fine.

    Here is how I set it for my different reports. I basically set it to true
    if the report is allowed to set to XLS and false if it can not.

    procedure TfrmHistory.rptHistory2PrintDialogCreate(Sender: TObject);
    begin

    TppCC4PrintDialog(rptHistory2.PrintDialog).CanPrintToXLS := False;

    end;

    Thanks in advance,
    Rodger Van Kirk


    Best Regards,

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