用水晶报表中的向导来作。Dim m_App As New CRAXDRT.Application Dim m_Report As New CRAXDRT.Report Dim m_Wizard As New CRStandardWizardSub Main() Dim tblCustomer As DatabaseTable Dim tblOrders As DatabaseTable Dim fldDef1 As DatabaseFieldDefinition Dim fldDef2 As DatabaseFieldDefinition Dim CustomerIDLink As TableLink
' Create a blank report Set m_Report = m_App.NewReport
With m_Report.Database ' Add a datasource to the report. The wizard will include any data ' source that has been added to the report .AddOLEDBSource DataEnvironment1.XtremeConnection, "Customer" .AddOLEDBSource DataEnvironment1.XtremeConnection, "Orders"
' Note that if you are adding multiple tables to a report and you want ' the tables to be linked, you must add the links before calling the ' Report Creation wizard. There is currently no visual linking done ' in the wizard. ' Get references to the database tables Set tblCustomer = .Tables(1) Set tblOrders = .Tables(2) ' Get references to each table's Customer ID field Set fldDef1 = .Tables(1).Fields(1) Set fldDef2 = .Tables(2).Fields(3)
' Add a link between the two tables Set CustomerIDLink = .Links.Add(tblCustomer, tblOrders, _ fldDef1, fldDef2, crJTEqual, _ crLTLookupParallel, False, True) End With ' Give the report wizard a starting report definition to work with. ' If you give it a report that includes other report objects such as fields ' or text objects, the report wizard will incorporate those pre-existing ' objects into the final report. In this case, we're giving the wizard ' a blank report with some database objects to work with. Set m_Wizard.CrystalReport = m_Report m_Wizard.DisplayReportWizard '就这句了 End Sub
Dim m_Report As New CRAXDRT.Report
Dim m_Wizard As New CRStandardWizardSub Main()
Dim tblCustomer As DatabaseTable
Dim tblOrders As DatabaseTable
Dim fldDef1 As DatabaseFieldDefinition
Dim fldDef2 As DatabaseFieldDefinition
Dim CustomerIDLink As TableLink
' Create a blank report
Set m_Report = m_App.NewReport
With m_Report.Database
' Add a datasource to the report. The wizard will include any data
' source that has been added to the report
.AddOLEDBSource DataEnvironment1.XtremeConnection, "Customer"
.AddOLEDBSource DataEnvironment1.XtremeConnection, "Orders"
' Note that if you are adding multiple tables to a report and you want
' the tables to be linked, you must add the links before calling the
' Report Creation wizard. There is currently no visual linking done
' in the wizard.
' Get references to the database tables
Set tblCustomer = .Tables(1)
Set tblOrders = .Tables(2)
' Get references to each table's Customer ID field
Set fldDef1 = .Tables(1).Fields(1)
Set fldDef2 = .Tables(2).Fields(3)
' Add a link between the two tables
Set CustomerIDLink = .Links.Add(tblCustomer, tblOrders, _
fldDef1, fldDef2, crJTEqual, _
crLTLookupParallel, False, True)
End With
' Give the report wizard a starting report definition to work with.
' If you give it a report that includes other report objects such as fields
' or text objects, the report wizard will incorporate those pre-existing
' objects into the final report. In this case, we're giving the wizard
' a blank report with some database objects to work with.
Set m_Wizard.CrystalReport = m_Report
m_Wizard.DisplayReportWizard '就这句了
End Sub
http://www.uepoch.com
众合打表,完美支持数据类表格、不规则表格、嵌套表格、票据套打等
在c/s下与在b/s下效果完全一致
首创web打印在服务端运行组件,客户端得到的是纯html页面,而打印显示效果与c/s下完全一致,包括斜线之类的特殊效果对于数据表,表格设置中可以选择打印的字段、顺序、分页字段、分组字短等等