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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
10 | |
10 | |
7 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |