Share via


ObjectFormat Class

Allows you to get or set formatting options that affect the physical behavior of objects in a report.

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

Syntax

'Declaration
Public Class ObjectFormat
    Inherits ReportObjectProperty
    Implements IDisposable
public class ObjectFormat : ReportObjectProperty, IDisposable

Remarks

Retrieve the ObjectFormat object through the ObjectFormat property of the ReportObject object.

Example

This example updates the properties of a blob field that determine the positioning and formatting of the object.

'Declaration

      Private Sub UpdateBlobFieldObjectProperties(ByVal myReportDocument As ReportDocument, ByVal reportObjectName As String, ByVal top As Integer, ByVal left As Integer, ByVal height As Integer, ByVal width As Integer)
        Dim myReportObject As ReportObject = myReportDocument.ReportDefinition.ReportObjects.Item(reportObjectName)
        If myReportObject.Kind = ReportObjectKind.BlobFieldObject Then
          Dim myBlobFieldObject As BlobFieldObject = myReportObject
          myBlobFieldObject.Top = top
          myBlobFieldObject.Left = left
          myBlobFieldObject.Height = height
          myBlobFieldObject.Width = width

          Dim myObjectFormat As ObjectFormat = myBlobFieldObject.ObjectFormat
          myObjectFormat.EnableCanGrow = False
          myObjectFormat.EnableSuppress = False
          myObjectFormat.EnableCloseAtPageBreak = True
          myObjectFormat.EnableKeepTogether = True
        End If
      End Sub
      
      private void UpdateBlobFieldObjectProperties(ReportDocument reportDocument, String reportObjectName, int top, int left, int height, int width)
      {
        ReportObject reportObject = reportDocument.ReportDefinition.ReportObjects[reportObjectName];
        if (reportObject.Kind == ReportObjectKind.BlobFieldObject)
        {
          BlobFieldObject blobFieldObject = (BlobFieldObject)reportObject;

          blobFieldObject.Top = top;
          blobFieldObject.Left = left;
          blobFieldObject.Height = height;
          blobFieldObject.Width = width;

          ObjectFormat objectFormat = blobFieldObject.ObjectFormat;
          objectFormat.EnableCanGrow = false;
          objectFormat.EnableSuppress = false;
          objectFormat.EnableCloseAtPageBreak = true;
          objectFormat.EnableKeepTogether = true;
        }
      }
      

Inheritance Hierarchy

Object
   EngineObjectBase
      ReportObjectProperty
         ObjectFormat

Version Information

Crystal Reports Basic for Visual Studio 2008

Supported since: Crystal Reports for Visual Studio .NET 2002

See Also

Reference

ObjectFormat Members
CrystalDecisions.CrystalReports.Engine Namespace