AreaFormat Class

Allows you to retrieve information and set options for a specified area in a report.

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

Syntax

'Declaration
Public Class AreaFormat
    Inherits EngineObjectBase
    Implements IDisposable
public class AreaFormat : EngineObjectBase, IDisposable

Example

This example initializes the AreaFormat settings based on the Area.Kind property. This method takes a ReportDocument object as a parameter.

'Declaration

      Private Sub InitializeAreaFormat(ByVal myReportDocument As ReportDocument)
        Dim myReportDefinition As ReportDefinition = myReportDocument.ReportDefinition
        Dim myAreas As Areas = myReportDefinition.Areas

        Dim myArea As Area
        For Each myArea In myAreas
          Dim myAreaFormat As AreaFormat = myArea.AreaFormat
          If myArea.Kind = AreaSectionKind.GroupHeader Then
            myAreaFormat.EnableNewPageBefore = True
          ElseIf myArea.Kind = AreaSectionKind.GroupFooter Then
            myAreaFormat.EnableNewPageAfter = True
          ElseIf myArea.Kind = AreaSectionKind.ReportFooter Then
            myAreaFormat.EnablePrintAtBottomOfPage = True
          ElseIf myArea.Kind = AreaSectionKind.ReportHeader Then
            myAreaFormat.EnableResetPageNumberAfter = True
          ElseIf myArea.Kind = AreaSectionKind.PageFooter Then
            myAreaFormat.EnableKeepTogether = True
          End If
        Next
      End Sub
    
      private void InitializeAreaFormat(ReportDocument reportDocument)
      {
        ReportDefinition reportDefinition = reportDocument.ReportDefinition;
        Areas areas = reportDefinition.Areas;

        for (int i=0; i<areas.Count; i++)
        {
          Area area = areas[i];
          AreaFormat areaFormat = area.AreaFormat;
          if (area.Kind == AreaSectionKind.GroupHeader)
          {
            areaFormat.EnableNewPageBefore = true;
          }
          else if (area.Kind == AreaSectionKind.GroupFooter)
          {
            areaFormat.EnableNewPageAfter = true;
          }
          else if (area.Kind == AreaSectionKind.ReportFooter)
          {
            areaFormat.EnablePrintAtBottomOfPage = true;
          }
          else if (area.Kind == AreaSectionKind.ReportHeader)
          {
            areaFormat.EnableResetPageNumberAfter = true;
          }
          else if (area.Kind == AreaSectionKind.PageFooter)
          {
            areaFormat.EnableKeepTogether = true;
          }
        }
      }
    

Inheritance Hierarchy

Object
   EngineObjectBase
      AreaFormat

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

AreaFormat Members
CrystalDecisions.CrystalReports.Engine Namespace