Section Class
Report areas contain at least one section. This class includes properties for accessing information regarding a section of a report.
Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)
Syntax
'Declaration
Public Class Section
Inherits EngineObjectBase
Implements IDisposable
public class Section : EngineObjectBase, IDisposable
Remarks
Retrieve the Section object by index or by name through the Item property of the Sections collection.
Example
This example shows how to center all PageHeader sections in a specified area.
'Declaration
Private Sub CenterReportObjects(ByVal myReportDocument As ReportDocument, ByVal areaName As String)
Dim myReportDefinition As ReportDefinition = myReportDocument.ReportDefinition()
Dim myAreas As Areas = myReportDefinition.Areas()
Dim myArea As Area = myAreas.Item(areaName)
Dim mySections As Sections = myArea.Sections()
Dim mySection As Section
For Each mySection In mySections
If mySection.Kind = AreaSectionKind.PageHeader Then
If mySection.SectionFormat.EnableSuppressIfBlank = False Then
Dim myReportObjects As ReportObjects = mySection.ReportObjects()
Dim myReportObject As ReportObject
For Each myReportObject In myReportObjects
myReportObject.ObjectFormat.HorizontalAlignment = Alignment.HorizontalCenterAlign
Next
End If
End If
Next
End Sub
private void CenterReportObjects(ReportDocument reportDocument, String areaName)
{
ReportDefinition reportDefinition = reportDocument.ReportDefinition;
Areas areas = reportDefinition.Areas;
Area area = reportDefinition.Areas[areaName];
if (area != null)
{
Sections sections = area.Sections;
for (int i=0; i<sections.Count; i++)
{
Section section = sections[i];
if (section.Kind == AreaSectionKind.PageHeader)
{
if (section.SectionFormat.EnableSuppressIfBlank == false)
{
ReportObjects reportObjects = section.ReportObjects;
for (int j=0; j<reportObjects.Count; j++)
{
ReportObject reportObject = reportObjects[j];
reportObject.ObjectFormat.HorizontalAlignment = Alignment.HorizontalCenterAlign;
}
}
}
}
}
}
Inheritance Hierarchy
Object
EngineObjectBase
Section
Version Information
Crystal Reports Basic for Visual Studio 2008
Supported since: Crystal Reports for Visual Studio .NET 2002
See Also
Reference
Section Members
CrystalDecisions.CrystalReports.Engine Namespace