Share via


ReportObject.ObjectFormat Property

Gets the ObjectFormat object.

Namespace CrystalDecisions.CrystalReports.Engine Assembly CrystalDecisions.CrystalReports.Engine (CrystalDecisions.CrystalReports.Engine.dll)

Syntax

'Declaration

Public Overrideable ReadOnly Property ObjectFormat As CrystalDecisions.CrystalReports.Engine.ObjectFormat
public virtual CrystalDecisions.CrystalReports.Engine.ObjectFormat ObjectFormat {get;}

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

ReportObject Class
ReportObject Members
CrystalDecisions.CrystalReports.Engine Namespace