How to Change Font Color and Size in Crystal Report on Run time
Public Sub setReportStyle(ByVal objReport As Object)
Dim intObjectCount As Integer
Try
intObjectCount = 0
'Checking whether report object is nothing or not
If Not Nothing Is objReport Then
'get all report sections into ReportSections variable
ReportSections = objReport.ReportDefinition.Sections
End If
If Not Nothing Is ReportSections Then
'Iterate through all sections
For Each Reportsection In ReportSections
'Iterate throw all fields in each section
For intObjectCount = 0 To Reportsection.ReportObjects.Count - 1
' for field type objects
If Reportsection.ReportObjects.Item(intObjectCount).Kind = ReportObjectKind.FieldObject
Then fldObject = Reportsection.ReportObjects.Item(intObjectCount)
Dim strName As String
If Not Nothing Is fldObject Then strName = fldObject.Name.ToLower fldObject.ApplyFont(New Font("Arial", 12, FontStyle.Underline))
fldObject.Color = Color.Maroon
End if
Next
Next
End if
Catch ex as Exception
End Try
End sub
Public Sub setReportStyle(ByVal objReport As Object)
Dim intObjectCount As Integer
Try
intObjectCount = 0
'Checking whether report object is nothing or not
If Not Nothing Is objReport Then
'get all report sections into ReportSections variable
ReportSections = objReport.ReportDefinition.Sections
End If
If Not Nothing Is ReportSections Then
'Iterate through all sections
For Each Reportsection In ReportSections
'Iterate throw all fields in each section
For intObjectCount = 0 To Reportsection.ReportObjects.Count - 1
' for field type objects
If Reportsection.ReportObjects.Item(intObjectCount).Kind = ReportObjectKind.FieldObject
Then fldObject = Reportsection.ReportObjects.Item(intObjectCount)
Dim strName As String
If Not Nothing Is fldObject Then strName = fldObject.Name.ToLower fldObject.ApplyFont(New Font("Arial", 12, FontStyle.Underline))
fldObject.Color = Color.Maroon
End if
Next
Next
End if
Catch ex as Exception
End Try
End sub
0 Comments:
Post a Comment
<< Home