How to cancel a FastReport print job?

2019-07-26 03:40发布

问题:

How do I show a MessageBox when a print job is canceled in FastReport's Print Job Dialog?

回答1:

if frxReport1.Print then Showmessage('Aborted');


回答2:

When frxReportPrint.Print returns false, it is either user cancel or error in printing. So you need to check Errors.Text is empty or not, like:

if not frxReportPrint.Print then
  if frxReportPrint.Errors.Text = '' then
    UserCancel := true
  else
    Abort; // something wrong during printing.