Symptom
How to alternate record background colors for a report using the Report Application Server (RAS) in Visual Studio .NET.
Resolution
- Use the ConditionFormula as per the following code:
sec = m_crReportDocument.ReportDefinition.DetailArea.Sections[0];SectionFormat seccon = sec.Format.Clone(true);CrystalDecisions.ReportAppServer.ReportDefModel.ConditionFormula cf2 = new CrystalDecisions.ReportAppServer.ReportDefModel.ConditionFormulaClass();
cf2.Text= "if Remainder(RecordNumber, 2) = 0 then Red else Yellow";
cf2.Syntax = CrFormulaSyntaxEnum.crFormulaSyntaxCrystal;seccon.ConditionFormulas.set_InternalItem((int)CrystalDecisions.ReportAppServer.ReportDefModel.CrSectionAreaFormatConditionFormulaTypeEnum.crSectionAreaConditionFormulaTypeBackgroundColor,cf2);m_crReportDocument.ReportDefController.ReportSectionController.SetProperty(sec,
CrReportSectionPropertyEnum.crReportSectionPropertyFormat, seccon);
- For more Report Application Server sample applications, see the .NET RAS SDK Samples wiki.
Keywords
KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To
Product
Crystal Reports 2008 V1