Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How To Chnage Fonts In Run-Time?

Status
Not open for further replies.

Caltang

Programmer
Apr 30, 2001
9
HK
Hello,

I want to change font for the report in runtime using RDC.How can i do that?

Thanks all
Calvin
 
Hey Calvin

Try the code below. It seesm to work OK

email me with any questions jonathan.phillips@bluespringsw.com


Public Sub LetsChangeTheFont()

Dim CrystalSections As Sections
Dim CrystalSection As Section
Dim CrystalReportObjects As ReportObjects
Dim CrystalFieldObject As FieldObject
Dim LoopCount As Integer

Set CrystalSections = Myreport.Sections
Set CrystalSection = CrystalSections(1) 'Report Header
Set CrystalReportObjects = CrystalSection.ReportObjects
For LoopCount = 1 To CrystalReportObjects.Count
If CrystalReportObjects.Item(LoopCount).Kind = crFieldObject Then
Set CrystalFieldObject = CrystalReportObjects.Item(LoopCount)
If CrystalFieldObject.Name = "Field1" Then
CrystalFieldObject.TextColor = vbRed
End If
End If
Next LoopCount

End Sub
 
I am using this code to change the font based on the report name and text field. It Works!

Dim crobj As Object
With crReport.Sections.Item(3)
For Each crobj In .ReportObjects

If crobj.Name = FieldName Then
If FirstForm <> &quot;Form1
FirstForm<> &quot;Form2n
If IsNumeric(fieldData) Then
If crobj.Name = &quot;fText35&quot; Then
If fieldData > 999999 Then
crobj.Font.Size = &quot;10.00&quot;
End If
Else
If prtAuth = False Then
If fieldData >= 10000000 Then
crobj.Font.Size &quot;11.00&quot;
End If
End If
End If
End If
End If

crobj.SetText fieldData
End If

Next
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top