1471500 - Using the RAS SDK for VS .NET, how do you set a field's background color?

SAP Knowledge Base Article - Public

1471500 - Using the RAS SDK for VS .NET, how do you set a field's background color?

Symptom

Resolution

The following code set the background color:

Private Sub SetBackgroundColorFormula(ByVal pstrFieldName As String, ByVal pstrFormula As String)
Dim col As ISCRReportObject = CType(crRepDef.FindObjectByName(pstrFieldName), ISCRReportObject)
Dim lstr As String = col.Border.ConditionFormulas(CrBorderConditionFormulaTypeEnum.crBorderConditionFormulaTypeBackgroundColor).Text

If lstr Is Nothing Then
  'Create a new formula for this object (i.e. this column in the report)
 
  Dim cf As ConditionFormula = New ConditionFormula
  Dim colTemp As ISCRReportObject = col
  cf.Text = pstrFormula
  cf.CopyTo(colTemp.Border.ConditionFormulas(CrBorderConditionFormulaTypeEnum.crBorderConditionFormulaTypeBackgroundColor))
  rptDoc.ReportClientDocument.ReportDefController.ReportObjectController.Modify(col, colTemp)
 
Else
  col.Border.ConditionFormulas(CrBorderConditionFormulaTypeEnum.crBorderConditionFormulaTypeBackgroundColor).Text = pstrFormula
End If
End Sub

 

Keywords

Forum Thread , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , How To

Product

Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports 2011 ; SAP Crystal Reports XI R2