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
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:
- Set hide for drill down.
- Keep area together.
- Set the new page after.
- Set the new page before
- Set the print at bottom of page
- Set the reset page number after
- Set the area visibility