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