1286222 - How to add a border using the Crystal Reports .NET inproc RAS SDK

SAP Knowledge Base Articles - public

1286222 - How to add a border using the Crystal Reports .NET inproc RAS SDK


How to add a border using the Crystal Reports .NET inproc RAS SDK.


  • Crystal Reports XI Release 2 Service Pack 2 and higher
  • C#


Sample code:

        using CrystalDecisions.CrystalReports.Engine;
        using CrystalDecisions.ReportAppServer.ClientDoc;
        // CR Declarations
        ReportDocument   m_boReportDocument;
        ISCDReportClientDocument    m_boReportClientDocument;
        CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject   m_boReportObject;
        CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject   m_boReportObjectModified;
         //create a new ReportDocument
         m_boReportDocument = new ReportDocument();

          //load the RPT file 
          //access the ReportClientDocument in the ReportDocument (EROM bridge)
          m_boReportClientDocument = boReportDocument.ReportClientDocument;
          //get the first section in the details section
          m_boReportObject = (CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject)  _
           //make a copy of the report object that we will modify
           m_boReportObjectModified = (CrystalDecisions.ReportAppServer.ReportDefModel.ReportObject)  m_boReportObject.Clone(true);
            //add the border to the left, right, top, and bottom of the ReportObject
            m_boReportObjectModified.Border.LeftLineStyle = CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum.crLineStyleDouble;
            m_boReportObjectModified.Border.RightLineStyle = CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum.crLineStyleDouble;
            m_boReportObjectModified.Border.TopLineStyle = CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum.crLineStyleDouble;
            m_boReportObjectModified.Border.BottomLineStyle = CrystalDecisions.ReportAppServer.ReportDefModel.CrLineStyleEnum.crLineStyleDouble;
            //modify the object - we don't use add here because we are modifying an existing object
            m_boReportClientDocument.ReportDefController.ReportObjectController.Modify(m_boReportObject, m_boReportObjectModified);
            //display in reportviewer
            crystalReportViewer1.ReportSource = m_boReportDocument;
Note: Prior to the release of Crystal Reports XI R2 Service Pack 2, report modification was only possible using the RAS (Report Application Server) SDK with a RAS server or by using In-Process RAS with the purchase of additional licensing.

Using Crystal Reports  XI R2 Service Pack 2 and higher, you can now access the report modification APIs without any additional licensing by using the inprocess-RAS engine through the Crystal Reports .NET SDK.


How add  border Crystal Reports .NET inproc RAS SDK , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To


SAP Crystal Reports XI R2