如何操作水晶报表里的对象

水晶报表9.2 + VB6.0,以Text控件为例

 1 Dim objCRApp As New CRAXDRT.Application    '水晶报表应用程序对象
 2 Dim objCRReport As New CRAXDRT.Report      '报表对象
 3 Dim oSection As CRAXDRT.Section  '报表节对象
 4 Dim myTextObject As TextObject
 5 '省略若干代码,打开rpt文件等 ...
 6 '循环获得报表对象的Section
 7 For Each oSection In objCRReport.Sections
 8       '打出来看一下都是些啥名
 9       Debug.Print oSection.Name
10       '找到Text控件所在的Section
11       If LCase(oSection.Name) = LCase("PageHeaderSection1"Then
12           '转换为TextObject,注意text2是我的实例中一个Text控件的名称
13           Set myTextObject = oSection.ReportObjects.Item("text2")
14           '赋值
15           myTextObject.SetText "xxxxxxxxxxxxxxxxxxxxxxx"
16     End If
17 Next
posted @ 2007-12-26 22:10  阿泰  阅读(2283)  评论(0编辑  收藏  举报