"Go" How do you use code to dynamically set up text, fields, and other objects in a crystal report?

Source: Internet
Author: User

Http://www.cnblogs.com/star250/archive/2008/12/22/1359810.html

How do I use code to dynamically set the text, fields, and other objects in a crystal report?

Vb

First, you have to declare an object variable (eg. Textobject, Fieldobject, ...), of course not the general object, but:    Dim xObject as CrystalDecisions.CrystalReports.Engine.FieldObject (field)    Dim XObject as CrystalDecisions.CrystalReports.Engine.TextObject (text) Dim XObject as CrystalDecisions.CrystalReports.Engine.LineObject (lines)    Dim XObject as CrystalDecisions.CrystalReports.Engine.BoxObject (rectangular box) ... Second, you must assign the real object of the Crystal report to it, for example:    xObject = CrReport.ReportDefinition.ReportObjects.Item ("Fieldobjectname")    xObject = CrReport.ReportDefinition.ReportObjects.Item ("Textobjectname")    XObject = CrReport.ReportDefinition.ReportObjects.Item ("Lineobjectname")    XObject = CrReport.ReportDefinition.ReportObjects.Item ("Boxobjectname") ... You can then invoke its various properties and methods:

For Fieldobject, you can: 1. Set the number of decimal places for numeric fields: XObject.FieldFormat.NumericFormat.DecimalPlaces = 4 2. Sets the output type of the Boolean field: XObject.FieldFormat.BooleanFormat.OutputType =crystaldecisions.shared.booleanoutputtype.yesorno 3. Set other formats such as (Com Monformat,datetimeformat,dateformat,timeformat)

For Textobject, you can: 1. Change the text: Xobject.text = "hehe" 2. Change font: Xobject.applyfont (New font, 1         0.0!)) 3. Set color: Xobject.color = color.red 3. Hide display: xObject.ObjectFormat.EnableSuppress = True

 For Lineobject, you can: 1. Set line style:           Xobject.linestyle = CrystalDecisions.Shared.LineStyle.DotLine         2. Set Line color:            Xobject.linecolor = Color.Blue         3. Set line width: xobject.linethickness = 3         4. Set other formats (such as: Location (Top,left,right,bottom), border, etc.) for Boxobject, you can: 1. Set Fill color:           xobject.fillcolor = Colo R.brown 2. Set line style:           Xobject.linestyle = CrystalDecisions.Shared.LineStyle.DotLine         3. Set Line color:            Xobject.linecolor = Color.Blue         4. Set line width: xobject.linethickness = 3         5. Set other formats such as: Position (top,Left,right,bottom), borders, etc.)

//c#    CrystalDecisions.CrystalReports.Engine.TextObject XObject; XObject = (CrystalDecisions.CrystalReports.Engine.TextObject)       crystalreportsource1.reportdocument.reportdefinition.reportobjects["Text1"]; xobject.text= "conditions";

"Go" How do you use code to dynamically set up text, fields, and other objects in a crystal report?

Related Article

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.