Skip to Content

How to set properties for Areas in a Crystal Report using .NET SDK?

Normally we work on Section Expert to manipulate the properties of the Area or the Section underlying it. How would it be if the same can be done using .NET SDK?

I would admit that it would be bit difficult, because it involves finding many things starting from Area Name. If you want to override the design settings at runtime then go for it. It can make things simple if used properly. If you are looking forward to update some of the properties of few Areas, then it’s a situation where this code will be useful.

For setting properties for all Areas in a report following code can be used

Sample Code

        ReportDocument reportDocument= new ReportDocument();


        ReportDefinition myReportDefinition = reportDocument.ReportDefinition;

        Areas areas = myReportDefinition.Areas;

        for (int i=0; i < areas.Count; i++)


          Area area = areas[i];

          if (area.Name == areaName)


            AreaFormat areaFormat = area.AreaFormat;

            areaFormat.EnableHideForDrillDown = true;

            areaFormat.EnableKeepTogether = true;

            areaFormat.EnableNewPageAfter = true;

            areaFormat.EnablePrintAtBottomOfPage = true;

            areaFormat.EnableResetPageNumberAfter = true;

            areaFormat.EnableSuppress = true;



The code can be tweaked a little for setting these properties for a specific area. If you have no idea on how to find the areas and don’t want to go to designer, this could be helpful.

As far as advantages are concerned you can:

  1. Set hide for drill down.
  2. Keep area together.
  3. Set the new page after.
  4. Set the new page before
  5. Set the print at bottom of page
  6. Set the reset page number after
  7. Set the area visibility
You must be Logged on to comment or reply to a post.
  • Hi Saurabh,

    Thanks for this useful post. I have a requirement and I think you can help me with that. I want to manage layout for detail area in CR through SDK, actually I want to set horizontal gap between details dynamically at runtime. I tried setting area format in SDK but I did not find any method or property for “Format with multiple columns”.

    Please tell me if .NET SDK provide any property for that, if yes then how I can use this.

    Please reply if you can help.

    Thanks in advance.

    • Hi Namrata,

      My findings says that this property does not exist in CR and RAS .NET SDK (probably not a part of public APIs).

      You can post your query here for more information on same.