转载

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()

End If

正文到此结束
Loading...