Partager via


DateTimeFieldFormat Classe

Permet d'extraire et de définir des options de format de date et d'heure d'un champ de type date/heure dans un rapport.

Pour obtenir la liste de tous les membres de ce type, voir les membres de la classe DateTimeFieldFormat.

System.Object
   CrystalDecisions.CrystalReports.Engine.EngineObjectBase
      CrystalDecisions.CrystalReports.Engine.ReportObjectProperty
         DateTimeFieldFormat

[Visual Basic]

Public Class DateTimeFieldFormat
   Implements IDisposable

[C#]

public class DateTimeFieldFormat : IDisposable

Exemple

[VJ#]

      private DateTimeFieldFormat getDateTimeFieldFormat
         (String reportObjectName)
      {
         FieldObject field;
         DateTimeFieldFormat dateTimeFormat = null;
         try
         {
            field = (FieldObject)Report.get_ReportDefinition()
               .get_ReportObjects().get_Item(reportObjectName);
            if (field.get_DataSource().get_ValueType() ==
               FieldValueType.DateTimeField)
               dateTimeFormat = field.get_FieldFormat().get_DateTimeFormat();
         }
         catch (Exception e)
         {
         }
         return dateTimeFormat;
      }
      
[Visual Basic]

      Private Function GetDateTimeFieldFormat _
         (ByVal reportObjectName As String) As DateTimeFieldFormat
      
         Dim field As FieldObject
         Dim dateTimeFormat As DateTimeFieldFormat
      
         If TypeOf _
            (Report.ReportDefinition.ReportObjects. _
            Item(reportObjectName)) Is FieldObject Then
            field = _
               Report.ReportDefinition.ReportObjects. _
               Item(reportObjectName)
            If field.DataSource.ValueType = _
               FieldValueType.DateTimeField Then
               dateTimeFormat = field.FieldFormat.DateTimeFormat
               GetDateTimeFieldFormat = dateTimeFormat
            Else : GetDateTimeFieldFormat = Nothing
            End If
         Else : GetDateTimeFieldFormat = Nothing
         End If
      End Function
      
[C#]

      private DateTimeFieldFormat GetDateTimeFieldFormat
         (string reportObjectName)
      {
         FieldObject field;
         DateTimeFieldFormat dateTimeFormat;
         field =
            Report.ReportDefinition.ReportObjects[reportObjectName]
            as FieldObject;
         if (field != null)
         {
            if (field.DataSource.ValueType ==
               FieldValueType.DateTimeField)
            {
               dateTimeFormat = field.FieldFormat.DateTimeFormat;
               return dateTimeFormat;
            }
            else return null;
         }
         else return null;
      }
      

Configuration requise

Espace de noms CrystalDecisions.CrystalReports.Engine

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

Voir aussi

DateTimeFieldFormat Membres | CrystalDecisions.CrystalReports.Engine Espace de noms

**

©2005 Business Objects SA. Tous droits réservés.

Business Objects SA.
http://www.france.businessobjects.com/
Services de support
http://www.businessobjects.com/support/