winfrom调用FastReport模板


'存放模板的路径

If Dir(Application.StartupPath & "\ReportsFile\HB\01\IN.frx", FileAttribute.Normal) <> "" Then    

  '加载模板

  rpt_Desi.Load(Application.StartupPath & "\ReportsFile\HB\01\IN.frx")    

  '传参数

  If rpt_Desi.Parameters.FindByName("sUser_c") IsNot Nothing Then        

    rpt_Desi.Parameters.FindByName("sUser_c").Value = G.LogUserName    

  End If    

  '传参数

  If rpt_Desi.Parameters.FindByName("LanguageCode") IsNot Nothing Then        

    rpt_Desi.Parameters.FindByName("LanguageCode").Value = ""    

  End If    

  '传参数

  If rpt_Desi.Parameters.FindByName("LogShopID") IsNot Nothing Then        

    rpt_Desi.Parameters.FindByName("LogShopID").Value = G.LogShopID    

  End If

  '传递连接字符串

  ES_Desi.DesignerSettings.ApplicationConnection = New SqlClient.SqlConnection    

  ES_Desi.DesignerSettings.ApplicationConnection.ConnectionString = DataConn.ConnectionString  

  '判断是否有导出Excel权限,若没有权限隐藏其它菜单,只显示关闭按钮  

  If cmdExcel.Enabled = False Then        

    FastReport.Utils.Config.PreviewSettings.Buttons = PreviewButtons.Close    

  End If    

  '设计模板

  rpt_Desi.Design()

  '直接预览

  'rpt_Desi.Show()

  '直接打印

  'rpt_Desi.Print()

End If

示例源码:

https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.3ad93b44ZEjXSF&id=558395981043

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM