• unigui+fastreport 打印【4】


    1、建立一个uniForm,用于建立FastReport打印界面。在Form上增加uniFrame。和传统的的报表打印设计一样一样的。

    2、在beofeShow事情中:

    procedure TUniFrm_Report.UniFormBeforeShow(Sender: TObject);
    var
      rptFileName,url: string;
    begin
      rptFileName := 'demo.fr3';
      frxrprt1.Clear();
      try
       frxrprt1.LoadFromFile(UniServerModule.FilesFolderPath+rptFileName);   //存放在files目录下面             
       frxrprt1.PrintOptions.ShowDialog := false;
       frxrprt1.ShowProgress := false;
       frxrprt1.EngineOptions.SilentMode := true;
       frxrprt1.EngineOptions.EnableThreadSafe := true;
       frxrprt1.EngineOptions.DestroyForms := false;
       frxrprt1.EngineOptions.UseGlobalDataSetList := false;
    
       frxpdfxprt1.Background:=true;
       frxpdfxprt1.ShowProgress:=False;
       frxpdfxprt1.ShowDialog:=false;
       frxpdfxprt1.FileName:=UniServerModule.NewCacheFileUrl(False,'pdf','','',url,true);
       frxpdfxprt1.DefaultPath := '';
    
       frxrprt1.PreviewOptions.AllowEdit := false;
       frxrprt1.PrepareReport();
       frxrprt1.Export(frxpdfxprt1);
    
       UniURLFrame1.URL := url;
      finally
        //CloseDB;
      end;
    end;

    3、在前端调用的代码

    procedure TUniFrmeWebEmbedBase_authoManage.act_PrtExecute(Sender: TObject);
    var prt : TUniFrm_Report;
    begin
    
      prt := TUniFrm_Report.Create(UniApplication);
      prt.ShowModal();
    
    
    end;

    4、关于乱码问题:

    5、其他:窗口有数据控件,不知道为什么会自动连接open,因此你要能保持open而不出错。否则,啥也没有。错误见类似图:

    OK,goodluck!

  • 相关阅读:
    MySQL学习笔记
    为什么使用多态?实现多态的有哪些方式
    C++中派生类使用基类成员的问题
    实现Modbus ASCII多主站应用
    PHP第四天 函数引用传值
    Webpack 快速上手(下)
    Java---23种设计模式(九)------组合模式
    【笔记】Linux就该这么学-第六课第四章
    Node.js HTTPS
    Node.js Smalloc
  • 原文地址:https://www.cnblogs.com/usegear/p/9460408.html
Copyright © 2020-2023  润新知