'集合声明
Private RepTxts As New ReportTXTs
Private RepCells As New ReportCells
Private RepPics As New ReportPics
Private RepObjs As New ReportObjs
Private RepFile As New ReportFile
'页面静态
Private PageHeader_TP As String
Private PageCauda_TP As String
Private ReportHeight_TP As Single
Private ReportWidth_TP As Single
Private Page_TP As Boolean
Private SetDate_TP As Boolean
Private Left_TP As Single
Private Top_TP As Single
Private Declare Function SetBitmapBits Lib "gdi32" (ByVal hBitmap As Long, ByVal dwCount As Long, lpBits As Any) As Long
'正文集合
Public Property Get Txts() As ReportTXTs
Set Txts = RepTxts
End Property
'表格集合
Public Property Get Cells() As ReportCells
Set Cells = RepCells
End Property
'图形集合
Public Property Get Pics() As ReportPics
Set Pics = RepPics
End Property
'对象绑定集合
Public Property Get Objs() As ReportObjs
Set Objs = RepObjs
End Property
Public Property Get File() As ReportFile
Set File = RepFile
End Property
'以下是页面设置信息
'页头设置
Public Property Get PageHeader() As String
PageHeader = PageHeader_TP
End Property
Public Property Let PageHeader(ByVal vData As String)
PageHeader_TP = vData
End Property
'页角设置
Public Static Property Get PageCauda() As String
PageCauda = PageCauda_TP
End Property
Public Static Property Let PageCauda(ByVal vData As String)
PageCauda_TP = vData
End Property
'报表高度
Public Property Get ReportHeight() As Single
ReportHeight = ReportHeight_TP
End Property
Public Property Let ReportHeight(ByVal vData As Single)
ReportHeight_TP = vData
End Property
'报表宽度
Public Property Get ReportWidth() As Single
ReportWidth = ReportWidth_TP
End Property
Public Property Let ReportWidth(ByVal vData As Single)
ReportWidth_TP = vData
End Property
'是否设置页号
Public Property Get Page() As Boolean
Page = Page_TP
End Property
Public Property Let Page(ByVal vData As Boolean)
Page_TP = vData
End Property
'是否设置日期
Public Property Get SetDate() As Boolean
SetDate = SetDate_TP
End Property
Public Property Let SetDate(ByVal vData As Boolean)
SetDate_TP = vData
End Property
'设置左边距
Public Property Get Left() As Single
Left = Left_TP
End Property
Public Property Let Left(ByVal vData As Single)
Left_TP = vData
End Property
'设置右边距
Public Property Get Top() As Single
Top = Top_TP
End Property
Public Property Let Top(ByVal vData As Single)
Top_TP = vData
End Property
Public Sub Proview()
'输出到预览,在此添加过程
Dim i As Long
ViewReport.AutoRedraw = True
For i = 1 To RepTxts.Count
ViewReport.CurrentX = RepTxts(i).CurrentX
ViewReport.CurrentY = RepTxts(i).CurrentY
ViewReport.Print RepTxts(i).Txt & vbLf
Next
For i = 1 To RepCells.Count
ViewReport.CurrentX = RepCells(i).CurrentX
ViewReport.CurrentY = RepCells(i).CurrentY
ViewReport.Print RepCells(i).Txt
Next
Dim jpg() As Byte
For i = 1 To RepPics.Count
jpg() = RepPics(i).Pic
SetBitmapBits ViewReport.Picture1.Image, UBound(RepPics(i).Pic), jpg(1)
Next
ViewReport.Show
End Sub
Private Sub Class_Terminate()
Set RepTxts = Nothing
Set RepCells = Nothing
Set RepPics = Nothing
Set RepObjs = Nothing
Set RepFile = Nothing
End Sub