Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
saurabh_pathak
Active Contributor
0 Kudos

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();

        reportDocument.Load(Server.MapPath("CrystalReports.rpt"));

        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
2 Comments
Labels in this area