[Original] transition to achieve dynamic Crystal Reports

Source: Internet
Author: User
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 in the crystal report. This is the necessary basis.

2. Then 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
Dry. Refresh ()

3. Basic completion. Pay attention to the sequence

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
Assembly: crystaldecisions. crystalreports. Engine (in crystaldecisions. crystalreports. Engine. dll)
Contains all information related to data operations (data operations are performed based on the data source in the report ).
For a list of all members of this type, see datadefinition member.
Object
Datadefinition
Remarks
You can use this class to define the method of selecting records for reports and groups, as well as to retrieve group sets and various field definition sets.
You can use the datadefinition attribute of the reportdocument object to retrieve the datadefinition object.

3. Use the formulafielddefinitions attribute of the datadefinition object to retrieve the formulafields object.
Datadefinition Member
Datadefinition class | crystaldecisions. crystalreports. Engine namespace
Public instance attributes
Formulafields formulafielddefinitions. Obtain the formulafielddefinitions set.

4. formulafielddefinitions class
Formulafielddefinitions member | crystaldecisions. crystalreports. Engine namespace
Requirements
Namespace: crystaldecisions. crystalreports. Engine
Platform: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP
Assembly: crystaldecisions. crystalreports. Engine (in crystaldecisions. crystalreports. Engine. dll)
The formulafielddefinition object that contains each formula field in the report.
For a list of all members of this type, see formulafielddefinitions members.
Object
Scrcollection
Formulafieldfielddefinitions
Remarks
You can use the formulafields attribute of the datadefinition object to retrieve the formulafielddefinitions set.

5. Obtain the formulafielddefinition object and set the formula.
For example: formulafielddefinition. Text = "{customer. Customer ID }"

Formulafielddefinition Member
Formulafielddefinition class | crystaldecisions. crystalreports. Engine namespace
Public instance attributes
Formulaname (inherited from fielddefinition) string. Obtain the unique formula name of the field definition in the Crystal Report formula syntax.
Kind (inherited from fielddefinition) fieldkind. Obtain the field type.
Name string. Obtain the name of the formula field displayed in "field resource manager.
Numberofbytes (inherited from fielddefinition) int32. Obtains the number of bytes required to store field data in the memory.
Text string. Obtain or set the text of the formula.
Usecount (inherited from fielddefinition) int32. Obtains the number of times a field is used in a report.
Valuetype (inherited from fielddefinition) fieldvaluetype. Type of the field value.
Public instance method
Check the formula. If a syntax error exists, the error string and false are returned.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.