去向导航
常用分类
中财税帮助系统
2008-10-7
欢迎您登陆并使用中国财税咨询中心为您免费提供的资料,交流,学习为一体的平台!
如果您在使用中遇到什么问题,请您不要吝啬,一定要写信给我们!!
Email:Shellapi@126.com 期待您的来信,或指导批语!
帮助内难免有收集的资料,如果侵犯了您的仅力,请您来信告知,我们马上删除或更新处理!
vb / C# 中报表套打的轻松实现
更多2008-10-7 日更新内容!
-
关键字: vb c# 报表 套打
微软的crystal report是非常不错的报表工具,今天我想和大家聊聊如果在vb 60 中使用crystal report 提供的环境在vb 中请轻松实现报表的套打功能。以水晶报表9为用例
craxddrt9.dll
craxddrt9_res_chs.dll
CRDesignerCtrl.DLL
crdesignerctrl_res_chs.dll
以上四个dll在你安装好水晶9后会存在你系统环境中。你可以在vb项目中通过浏览文件直接引用这几个dll
,或则在引用checkbox 列表中选 "reystal reports 9 activex Designer run time library",""
"reystal reports 9 activex Designer Design and runtime library"
然后再工具箱添加一个 compernent 选"Embeddedle crystal report 9 designer Control"
添加后工具箱多了一个CRDesignerCtrl
ok 环境有了,然后我们可以把crystal report 的设计界面嵌入到我们的vb程序了。
程序效果如下:
design
简述一下如何将一个rpt文件打开成设计界面
代码如下
[vb 6]
Private Sub Command1_Click()
Dim f_Name As String
Dim m_Application As New CRAXDDRT.Application
Dim m_Report As New CRAXDDRT.Report
reportPath = ""
Me.CommonDialog1.ShowOpen
reportPath = Me.CommonDialog1.FileName
If reportPath <> "" Then
Set m_Report = m_Application.OpenReport(reportPath, 0)
Me.CRDesignerCtrl1.ReportObject = m_Report
End If
End Sub
CRDesignerCtrl1为前面我们添加的报表设计控件。
[c#]
CRAXDDRT.Application m_Application = new CRAXDDRT.ApplicationClass();
CRAXDDRT.Report m_Report;
this.openFileDialog1.ShowDialog();
f_Name=this.openFileDialog1.FileName.ToString();
m_Report=m_Application.OpenReport(f_Name,0);
this.axCRDesignerCtrl1.ReportObject=m_Report;
this.axCRDesignerCtrl1.DisplayFieldView=false;
#结束
