SectionFormat.EnableSuppressIfBlank Property
Gets or sets the option that indicates whether to suppress the current section if it is blank.
Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)
Syntax
'Declaration
Public Overrideable Property EnableSuppressIfBlank As Boolean
public virtual bool EnableSuppressIfBlank {get; set;}
Example
This example shows how to center all PageHeader sections in a specified area. This method takes a ReportDocument and name parameter.
'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;
}
}
}
}
}
}
Version Information
Crystal Reports Basic for Visual Studio 2008
Supported since: Crystal Reports for Visual Studio .NET 2002
See Also
Reference
SectionFormat Class
SectionFormat Members
CrystalDecisions.CrystalReports.Engine Namespace