Beginners often think that a crystal report is like a datagrid, giving it a data source, and then it will be displayed.
However, this kind of dynamic crystal report cannot be implemented, but it just needs to be implemented in turn. If it is absolutely necessary, ask the crystal developer.
The following describes how to implement it. The principle is as follows. You need to call it by yourself.
The main steps are as follows:
1. Insert FormulaFields and text object into the crystal report.
2. In the program
In the Dim dry As New CrystalReport1 project, the Crystal Report class name is CrystalReport1.
'Text 1
Dry. ReportDefinition. ReportObjects. Item ("text1"). Left = 12' typographical
Dry. ReportDefinition. ReportObjects. Item ("text1"). ObjectFormat. EnableCanGrow = True
Dim GetTextObject1 As CrystalDecisions. CrystalReports. Engine. TextObject
GetTextObject1 = dry. ReportDefinition. ReportObjects. Item ("text1 ")
GetTextObject1.Text = "love you..." 'pay value
'Field 1
Dry. ReportDefinition. ReportObjects. Item ("t1"). Left = 12' typographical
Dry. DataDefinition. FormulaFields ("t1"). Text = "{codes. type_id}" 'value, table name. Field
3. Basic completion
Bytes ------------------------------------------------------------------------------------------
Refer:
1. Retrieve the DataDefinition object through the DataDefinition attribute of the ReportDocument object.
ReportDocument Member
Public instance attributes
DataDefinition. Obtain the DataDefinition object.
2. DataDefinition class
DataDefinition member | CrystalDecisions. CrystalReports. Engine namespace
Requirements
Namespace: CrystalDecisions. CrystalReports. Engine
Platform: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP