【问题标题】:How execute a TQuickRep (quickreport) without displaying or printing it?如何在不显示或打印的情况下执行 TQuickRep(快速报告)?
【发布时间】:2020-08-24 10:23:29
【问题描述】:

我需要运行一份报告 (TQuickRep) 仅用于导出,无需打印或显示。 Prepare 方法什么都不做。 beforeprints 或 afterprints 事件不会触发。

例如

var rep: TMyQuickRep; //TMyQuickRep is a report TQuickRep
begin
  rep := TMyQuickRep.Create(Self);
  try
    rep.SomeData := somedata;
    rep.DataSet  := somDataSet;
    rep.Prepare;
    //rep.Run? there isn´t a method for run
    rep.ExportToFilter(TQRPDFDocumentFilter.Create('c:\temp\myreport.pdf'));  
    //pdf is an empty page
  finally
    FreeAndNil(rep);
  end;
end;

【问题讨论】:

  • 您是否在将活动打印机设置为Microsoft Print to PDF 设备后尝试打印?
  • 不,我不需要打印。我需要在静默模式下创建 pdf 文件,并将其显示到导航器中。使用 FastReports 很容易。
  • 那为什么不使用 FastReports 呢?
  • QR 默认不具备此功能,我们使用第三方组件导出为 PDF,特别是对于我们不想转换为 FR 的旧报告。这是不使用 QR 并切换到 FR 的众多原因之一,这在各个方面都更好。
  • 好的。谢谢。那我就用FR! ;)

标签: delphi export-to-pdf silent quickreports


【解决方案1】:

这应该对你有用...(我一直在寻找这样的解决方案,下面的代码对我有用。)

rep.ExportToFilter(TQRPDFDocumentFilter.Create('c:\temp\myreport.pdf')); 
rep.Print;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-11
    • 2011-01-04
    • 1970-01-01
    • 2016-03-13
    • 1970-01-01
    • 1970-01-01
    • 2012-12-04
    相关资源
    最近更新 更多