Dynamic Crystal Report of variable direction realization

Source: Internet
Author: User
Dynamic | Crystal Report often beginners feel that crystal report like a DataGrid, give it a data source, and then it will show
However, this dynamic Crystal report is not not can not be achieved, but to the realization of the transformation, the absolute words to ask the Crystal developers
Here is how to do it, the principle is that the specific requirements need to call their own
The main steps are as follows:

1. Insert Formulafields,text object in Crystal Report

2. In the process
Dim Dry as New CrystalReport1 ' project Crystal Report class name CrystalReport1
' Text 1
Dry. ReportDefinition.ReportObjects.Item ("Text1"). left = 12 ' typesetting
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 ' typesetting
Dry. Datadefinition.formulafields ("T1"). Text = "{codes.type_id}" ' Pay value, table name. field

3. Basic completion

------------------------------------------------------------------------------------------
Reference:
1, through the Reportdocument object Datadefinition property to retrieve the Datadefinition object.
Reportdocument Members
Public instance Properties
Datadefinition datadefinition. Gets the Datadefinition object.
2, Datadefinition class
Datadefinition Members | CrystalDecisions.CrystalReports.Engine namespaces
Requirements
Namespaces: 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 the information related to the operation of the data (data operations are based on the data source in the report).
For a list of all members of the type, see Datadefinition members.
Object
Datadefinition
Note
You can use this class to define how records are selected for reports and groups, and to retrieve group collections and various field definition collections.
Retrieves the Datadefinition object by reportdocument The object's Datadefinition property.

3, through the Datadefinition object Formulafielddefinitions property to retrieve the Formulafields object.
Datadefinition Members
Datadefinition Class | CrystalDecisions.CrystalReports.Engine namespaces
Public instance Properties
Formulafields formulafielddefinitions. Gets the Formulafielddefinitions collection.

4, Formulafielddefinitions class
Formulafielddefinitions Members | CrystalDecisions.CrystalReports.Engine namespaces
Requirements
Namespaces: 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 the type, see Formulafielddefinitions members.
Object
Scrcollection
Formulafieldfielddefinitions
Note
Retrieves the Formulafielddefinitions collection by datadefinition the object's Formulafields property.

5, get the Formulafielddefinition object, and set the formula.
such as: Formulafielddefinition.text = "{customer. Customer ID}"

Formulafielddefinition Members
Formulafielddefinition Class | CrystalDecisions.CrystalReports.Engine namespaces
Public instance Properties
Formulaname (inherited from FieldDefinition) string. Gets the field definition unique formula name in the syntax of Crystal.
Kind (inherited from FieldDefinition) Fieldkind. Gets the type of the field.
The name string. Gets the name of the formula field that is displayed in the field Explorer.
Numberofbytes (inherited from FieldDefinition) Int32. Gets the number of bytes required to store field data in memory.
The Text string. Gets or sets the text of the formula.
Usecount (inherited from FieldDefinition) Int32. Gets the number of times a field is used in a report.
ValueType (inherited from FieldDefinition) Fieldvaluetype. Gets the type of the field value.
Public instance methods
Check checking formula. If there is a syntax error, 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.