行中的一个字段高度因为内容太长而自动换行时,高度增加。
因为是表格样式,增高的字段的边框和其他的字段的边框不能形成表格行。
在Detail的事件中写入:
With ActiveReport1
Dim C As Object
For Each C In .Detail.Controls
If Left(C.Name, 3) = "txt" Then
C.Height = .Detail.Height
End If
Next
End With
不管是在Event Format,BefortPrint,AfterPrint中这段代码都毫无作用。晕啊.............................................................有没有象Excel那样不用画边框,会自动缩小或换行的报表啊?
感觉ActiveReport已经最接近我的要求了。
水晶报表好差啊,基本上是不适合作中国报表的。
因为是表格样式,增高的字段的边框和其他的字段的边框不能形成表格行。
在Detail的事件中写入:
With ActiveReport1
Dim C As Object
For Each C In .Detail.Controls
If Left(C.Name, 3) = "txt" Then
C.Height = .Detail.Height
End If
Next
End With
不管是在Event Format,BefortPrint,AfterPrint中这段代码都毫无作用。晕啊.............................................................有没有象Excel那样不用画边框,会自动缩小或换行的报表啊?
感觉ActiveReport已经最接近我的要求了。
水晶报表好差啊,基本上是不适合作中国报表的。
.Detail.Height你可以不用管它,因为它的值在小于其中控件的高度时就不起作用了.
代码如下:
With ArPackBargainOut
Dim i As Integer, B As Boolean
Dim hMax As Long, h As Long
h = 0
hMax = 0
B = False 'B用来判断是否有字段GROW。
i = 1
Dim C As Object
For Each C In .Detail.Controls
If Left(C.Name, 3) = "txt" Then
h = C.Height
If h > hMax Then
If hMax > 0 Then B = True
hMax = h
End If
End If
Next
If B = True Then
For Each C In .Detail.Controls
If Left(C.Name, 3) = "txt" Then
C.Height = hMax
End If
Next
End If
End With
正在用FRAME组件解决中,很不好用但是可以解决问题,无奈。
你有用过AtiveReprot吗?如果有,请到帖子:
http://expert.csdn.net/Expert/topic/2925/2925047.xml?temp=.8449518
中指点一下。
把
If h > hMax Then
If hMax > 0 Then B = True
hMax = h
End If
该成:
If h > hMax Then
B = True
hMax = h
End If
然后在BefortPrint事件中写代码试试看
应该是C.Height = hMax不起作用的原因。
在Detail 的 BefortPrint 事件中加入 以下代码: With ActiveReport1
Dim C As Object
For Each C In .Detail.Controls
If Left(C.Name, 3) = "txt" Then
C.Height = .Detail.Height
End If
Next
End With
CanGrow=True是默认设置。