• Lunes 18 de Noviembre de 2024, 01:45

Autor Tema:  Clase Para Crear Informe  (Leído 1851 veces)

vallekas0

  • Nuevo Miembro
  • *
  • Mensajes: 2
    • Ver Perfil
Clase Para Crear Informe
« en: Martes 1 de Abril de 2008, 10:44 »
0
Buenos días,

Tengo una duda, ¿siempre hay que crear una clase de este tipo (mirar el código de abajo) por cada informe que se cree?

Código: Text
  1. Option Strict Off
  2. Option Explicit On
  3.  
  4. Imports CrystalDecisions.CrystalReports.Engine
  5. Imports CrystalDecisions.ReportSource
  6. Imports CrystalDecisions.Shared
  7. Imports System
  8. Imports System.ComponentModel
  9. Imports Microsoft.VisualBasic
  10.  
  11.  
  12. Namespace CR_PF_Extracto
  13.  
  14.     Public Class Rpt_PF_Extracto
  15.         Inherits ReportClass
  16.  
  17.         Public Sub New()
  18.             MyBase.New()
  19.         End Sub
  20.  
  21.         Public Overrides Property ResourceName() As String
  22.             Get
  23.                 Return "Rpt_PF_Extracto.rpt"
  24.             End Get
  25.             Set(ByVal value As String)
  26.                 'Do nothing
  27.             End Set
  28.         End Property
  29.  
  30.         <Browsable(False), _
  31.          DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
  32.         Public ReadOnly Property Section1() As CrystalDecisions.CrystalReports.Engine.Section
  33.             Get
  34.                 Return Me.ReportDefinition.Sections(0)
  35.             End Get
  36.         End Property
  37.  
  38.         <Browsable(False), _
  39.          DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
  40.         Public ReadOnly Property Section2() As CrystalDecisions.CrystalReports.Engine.Section
  41.             Get
  42.                 Return Me.ReportDefinition.Sections(1)
  43.             End Get
  44.         End Property
  45.  
  46.         <Browsable(False), _
  47.          DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
  48.         Public ReadOnly Property Section3() As CrystalDecisions.CrystalReports.Engine.Section
  49.             Get
  50.                 Return Me.ReportDefinition.Sections(2)
  51.             End Get
  52.         End Property
  53.  
  54.         <Browsable(False), _
  55.          DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
  56.         Public ReadOnly Property Section4() As CrystalDecisions.CrystalReports.Engine.Section
  57.             Get
  58.                 Return Me.ReportDefinition.Sections(3)
  59.             End Get
  60.         End Property
  61.  
  62.         <Browsable(False), _
  63.          DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
  64.         Public ReadOnly Property Section5() As CrystalDecisions.CrystalReports.Engine.Section
  65.             Get
  66.                 Return Me.ReportDefinition.Sections(4)
  67.             End Get
  68.         End Property
  69.     End Class
  70.  
  71.     <System.Drawing.ToolboxBitmapAttribute(GetType(CrystalDecisions.Shared.ExportOptions), "report.bmp")> _
  72.     Public Class CachedRpt_PF_Extracto
  73.         Inherits Component
  74.         Implements ICachedReport
  75.  
  76.         Public Sub New()
  77.             MyBase.New()
  78.         End Sub
  79.  
  80.         Public Overridable Property IsCacheable() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.IsCacheable
  81.             Get
  82.                 Return True
  83.             End Get
  84.             Set(ByVal value As Boolean)
  85.                 '
  86.             End Set
  87.         End Property
  88.  
  89.         Public Overridable Property ShareDBLogonInfo() As Boolean Implements CrystalDecisions.ReportSource.ICachedReport.ShareDBLogonInfo
  90.             Get
  91.                 Return False
  92.             End Get
  93.             Set(ByVal value As Boolean)
  94.                 '
  95.             End Set
  96.         End Property
  97.  
  98.         Public Overridable Property CacheTimeOut() As System.TimeSpan Implements CrystalDecisions.ReportSource.ICachedReport.CacheTimeOut
  99.             Get
  100.                 Return CachedReportConstants.DEFAULT_TIMEOUT
  101.             End Get
  102.             Set(ByVal value As System.TimeSpan)
  103.                 '
  104.             End Set
  105.         End Property
  106.  
  107.         Public Overridable Function CreateReport() As CrystalDecisions.CrystalReports.Engine.ReportDocument Implements CrystalDecisions.ReportSource.ICachedReport.CreateReport
  108.             Dim rpt As Rpt_PF_Extracto = New Rpt_PF_Extracto
  109.             rpt.Site = Me.Site
  110.             Return rpt
  111.         End Function
  112.  
  113.         Public Overridable Function GetCustomizedCacheKey(ByVal request As RequestContext) As String Implements CrystalDecisions.ReportSource.ICachedReport.GetCustomizedCacheKey
  114.             Dim key As [String] = Nothing
  115.                     Return key
  116.         End Function
  117.     End Class
  118.  
  119. End Namespace
  120.  
  121.  
  122.  

Muchas gracias.