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)



Public Overrideable Property EnableSuppressIfBlank As Boolean
public virtual bool EnableSuppressIfBlank {get; set;}


This example shows how to center all PageHeader sections in a specified area. This method takes a ReportDocument and name parameter.


  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
        End If
      End If
  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


SectionFormat Class
SectionFormat Members
CrystalDecisions.CrystalReports.Engine Namespace