FastReport.Net v2016.6 FastScript安装 安装 VCL mvc FastReport.Net 报表 FastReport.Net v2016.2 TeeChart,图表开发 FastReport FMX 2.3 FastReport.Net v2016.1 FastReport.Net更新 FastCube VCL v2.5 FastReport VCL FastReport Online Designer教程 FastReport Online Designer组件 FastReport在线报表设计器:组件简介 FastReport在线报表设计器:界面结构简介 FastReport在线报表设计器:工作原理 FastReport Online Designer简介 FastReport Online Designer促销 FastReport Online Designer FastReport.Net授权促销 数据库查询构建 使用技巧 fastreport,报表 脚本引擎 FastScript FastScript, 脚本引擎 OLAP控件
作者:zhuhm 来源:本站原创 浏览:Loading... 日期:2013-01-25
下面是一个关于VB6的例子,主要演示了如何利用TfrxUserDataset创建主/从报表。
Dim frx As TfrxReport
Dim master_index As Integer
Dim detail_index As Integer
Dim mas(1 To 3, 1 To 20) As Integer
Dim WithEvents master_dataset As TfrxUserDataSet
Dim WithEvents detail_dataset As TfrxUserDataSet
Private Sub Command1_Click()
frx.ShowReport
End Sub
Rem ***** MASTER DATASET *****
Private Sub master_dataset_OnCheckEOF(IsEOF As Boolean)
If master_index = 20 Then
IsEOF = True
Else
IsEOF = False
End If
End Sub
Private Sub master_dataset_OnFirst()
master_index = 1
End Sub
Private Sub master_dataset_OnGetValue(ByVal VarName As Variant, Value As Variant)
If VarName = "Field1" Then
Value = mas(1, master_index)
ElseIf VarName = "Field2" Then
Value = mas(2, master_index)
ElseIf VarName = "Field3" Then
Value = mas(3, master_index)
End If
End Sub
Private Sub master_dataset_OnNext()
master_index = master_index + 1
End Sub
Private Sub master_dataset_OnPrior()
master_index = master_index - 1
End Sub
Rem ***** DEATIL DATASET *****
Private Sub detail_dataset_OnCheckEOF(IsEOF As Boolean)
If detail_index = 20 Then
IsEOF = True
Else
IsEOF = False
End If
End Sub
Private Sub detail_dataset_OnFirst()
detail_index = 1
End Sub
Private Sub detail_dataset_OnGetValue(ByVal VarName As Variant, Value As Variant)
If VarName = "Detail_1" Then
Value = "Master is " + Str(master_index)
ElseIf VarName = "Detail_2" Then
Value = mas(2, detail_index)
ElseIf VarName = "Detail_3" Then
Value = mas(3, detail_index)
End If
End Sub
Private Sub detail_dataset_OnNext()
detail_index = detail_index + 1
End Sub
Private Sub detail_dataset_OnPrior()
detail_index = detail_index - 1
End Sub
Private Sub Design_Click()
Dim designer As TfrxDesigner
Set designer = CreateObject("FastReport.TfrxDesigner")
Rem It would be better to keep commented the following line
'designer.Standalone = True
frx.DesignReport
Set designer = Nothing
End Sub
Private Sub Form_Load()
Dim i As Integer
Dim j As Integer
Set frx = CreateObject("FastReport.TfrxReport")
Set master_dataset = CreateObject("FastReport.TfrxUserDataSet")
Set detail_dataset = CreateObject("FastReport.TfrxUserDataSet")
frx.EngineOptions.SilentMode = simMessageBoxes
Rem Fill data with random values
Randomize Timer
For i = 1 To 3 Step 1
For j = 1 To 20 Step 1
mas(i, j) = Round(Rnd(1000) * 1000)
Next j
Next i
master_dataset.Name = "MyDataSet"
master_dataset.Fields = "Field1" + Chr(13) + Chr(10) + "Field2" + Chr(13) + Chr(10) + "Field3"
detail_dataset.Name = "DetailDataSet"
detail_dataset.Fields = "Detail_1" + Chr(13) + Chr(10) + "Detail_2" + Chr(13) + Chr(10) + "Detail_3"
frx.LoadReportFromFile ("UserDataSet.fr3")
master_index = 1
detail_index = 1
frx.SelectDataset True, master_dataset
frx.SelectDataset True, detail_dataset
End Sub
Private Sub Form_Unload(Cancel As Integer)
frx.SelectDataset False, master_dataset
frx.SelectDataset False, detail_dataset
Set detail_dataset = Nothing
Set master_dataset = Nothing
Set frx = Nothing
End Sub
Tag标签:FastReport.Net
慧都科技旗下网站-FastReport中文网版权所有 Copyright 2012
FastReport,报表控件,FastReport报表,VCL报表,.NET报表,COM/ActiveX报表,OLAP控件,联机分析处理