问题:
如何在报表中为每列加一条竖线
回答:
1、在设计模式里打开该报表,把要加左竖线、右竖线的TextBox的Tag属性都改成left,把要同时加左右竖线的TextBox的Tag属性改成l__R。
2、然后,在主体的格式化事件里输入如下代码:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim a As Control
For Each a In Me.Controls
If a.ControlType = acTextBox And a.Tag = "left" Then
Me.Line (a.Left, 0)-(a.Left, a.Height)
ElseIf a.ControlType = acTextBox And a.Tag = "L__R" Then
Me.Line (a.Left, 0)-(a.Left, a.Height)
Me.Line (a.Left + a.Width, 0)-(a.Left + a.Width, a.Height)
End If
Next
End Sub
4、预览报表就可以看到报表上每个文本框左右都有一条竖线,这竖线可是会随TextBox的左右、大小变化而自动修正变化的。
'以下方法展示如何用 LINE 为报表画边界
Private Sub Report_Page()
Me.Line (1, 1)-(Me.ScaleWidth, Me.ScaleHeight), , B
End Sub |