1666618 - How to find Areas of the Crystal Report using Crystal Reports .NET SDK?

SAP Knowledge Base Article - Public

1666618 - How to find Areas of the Crystal Report using Crystal Reports .NET SDK?

Symptom

How to find Areas of the Crystal Report using Crystal Reports .NET SDK?

Environment

  • Crystal Reports 2008
  • Crystal Reports for Visual Studio 2010

Resolution

Following code can be used:

ReportDocument reportDocument = new ReportDocument();
string reportPath = Server.MapPath("CrystalReports.rpt");
reportDocument.Load(reportPath);
ReportDefinition reportDefinition = reportDocument.ReportDefinition;
 Areas areas = reportDefinition.Areas;
        if(areas.Count > 0)
        {
            Response.Write("</br>");
            Response.Write("</br>");
            Response.Write("<table border=1 cellspacing=2>");
            Response.Write("<tr>");
            Response.Write("<td><b>Area Format</b></td>");
            Response.Write("<td><b>Area Kind</b></td>");
            Response.Write("<td><b>Area Name</b></td>");
            Response.Write("</tr>");
            foreach (Area area in areas)
            {
                Response.Write("<tr>");
                Response.Write("<td>" + area.AreaFormat.ToString() + " </td>");
                Response.Write("<td>" + area.Kind.ToString() + " </td>");
                Response.Write("<td>" + area.Name + " </td>");
                Response.Write("</tr>");
            }
             Response.Write("</table>");
        }
     }

Keywords

CR CRVS2010 CRVS SDK area , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio