Dim sect, ctl
For Each sect In printaddpsd.Sections
debug.Print "Section",sect.Name For Each ctl In sect.controls
Debug.Print , ctl.Name, ctl.Caption ', ctl.Index ', ctl.Caption '遍历打印报表的各段及各段的控件
Next ctl
Next sect
然后再具体设置
printaddpsd.Sections(2).Controls.Item(3).Caption = Text2.Text
For Each sect In printaddpsd.Sections
debug.Print "Section",sect.Name For Each ctl In sect.controls
Debug.Print , ctl.Name, ctl.Caption ', ctl.Index ', ctl.Caption '遍历打印报表的各段及各段的控件
Next ctl
Next sect
然后再具体设置
printaddpsd.Sections(2).Controls.Item(3).Caption = Text2.Text
Dim sect, ctl
For Each sect In datareport1.Sections
Debug.Print "Section", sect.Name
For Each ctl In sect.Controls
Debug.Print ,ctl.Name, ctl.Caption ', ctl.Index ', ctl.Caption '遍历打印报表的各段及各段的控件
Next ctl
Next sect运行时提示:debug.print ,crl.name,ctl.caption这行,无效的属性或方法,
加入DRgrzz.Sections(1).Controls ("label4"), Caption = "a"后
提示后加入行controls处提示属性的使用无效!
不过,我又遇到了又一个问题,我在用datareport中的image,代码如下:DRgrzz.Sections("section1").Controls("Image1").Picture = LoadPicture("c:\aa.jpg"),结果运行后告诉我“对象不支持该属性或方法”,image支持动态加载图片呀,在datareport中不行吗?那什么报表可以动态加载图片,具体该怎么做呢?请大虾们知道!谢谢
datareport的控件是有自己的一套做法的