Symptom
Resolution
- As these changes fall under Report Creation APIs, the Report Application server SDK must be used
- The RAS controllers modify methods must be used to change report object values
- Code to change font name and size:
For Each area As CrystalDecisions.CrystalReports.Engine.Area In rpt.ReportDefinition.Areas
For Each section As CrystalDecisions.CrystalReports.Engine.Section In area.Sections
For Each obj As CrystalDecisions.CrystalReports.Engine.ReportObject In section.ReportObjects
If obj.Kind = CrystalDecisions.Shared.ReportObjectKind.FieldObject Then
Dim objField As CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject = CType(rcd.ReportDefController.ReportObjectController.GetAllReportObjects().Item(obj.Name), CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject)
objField.FontColor.Font.Name = myFont.Name
objField.FontColor.Font.Size = myFont.Size
rcd.ReportDefController.ReportObjectController.Modify(CType(rcd.ReportDefController.ReportObjectController.GetAllReportObjects().Item(obj.Name), CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject), objField)
ElseIf obj.Kind = CrystalDecisions.Shared.ReportObjectKind.TextObject Then
Dim objText As CrystalDecisions.ReportAppServer.ReportDefModel.TextObject = CType(rcd.ReportDefController.ReportObjectController.GetAllReportObjects().Item(obj.Name), CrystalDecisions.ReportAppServer.ReportDefModel.TextObject)
objText.FontColor.Font.Name = myFont.Name
objText.FontColor.Font.Size = myFont.Size
rcd.ReportDefController.ReportObjectController.Modify(CType(rcd.ReportDefController.ReportObjectController.GetAllReportObjects().Item(obj.Name), CrystalDecisions.ReportAppServer.ReportDefModel.TextObject), objText)
End If
Next
Next
Next
Keywords
KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem