使用crystal report中的参数动态设置font-size

时间:2014-11-03 09:33:17

标签: crystal-reports

如何为水晶报表中的所有字段动态设置字体大小,以便使用一个参数用户可以更改整个报表的字体大小?

1 个答案:

答案 0 :(得分:0)

您可以为所有字段/文本执行此操作。见下文:

aa = Report.Sections.Item("D").ReportObjects.Count
For i = 1 To aa
    Set crxFieldObject = Report.Sections.Item("D").ReportObjects.Item(i)
    bb = crxFieldObject.Name
    If Mid(bb, 1, 5) = "Field" Then
        cc = Val(Mid(bb, 6))
        For j = 1 To NumberOfFields 'your value
            If cc = xxxxx Then 'if your condition 
                crxFieldObject.suppress = False
                crxFieldObject.Left = Leftxxxx 'your value
                crxFieldObject.Top = Topxxxx 'your value
                crxFieldObject.Font.Size = Fontsizexxxx 'your value
                TenPointHeight = 221 'you can change this, too
                If crxFieldObject.Font.Size = 10 Then
                    crxFieldObject.Height = TenPointHeight
                Else
                    crxFieldObject.Height = TenPointHeight * crxFieldObject.Font.Size / 10
                End If
            End If
        Next j
    End If
Next i