Programming Change text object sample code

zhaozj2021-02-16  57

Using crystaldecisions.crystalreports.Engine;

Private const string report_name = @ "../../ craystalreportanalysis.rpt"; private const string text_object_name = @ "text1";

Private Void Form1_Load (Object Sender, System.EventArgs E) {report = new reportDocument (); Report.Load (Report_Name); Report.Refresh ();

CRVCHART.REPORTSOURCE = Report;

Private void btnchangetext_click (object sender, system.eventargs e) {textObject text; text = getTextObject (Text_Object_name);

TEXT.TEXT = "Hello, Haibo.net!";

CRVCHART.REFRESHREPORT ();

Private textObject GetTextObject (String reportObjectname) {textObject text;

// Get the ReportObject by name, convert it to TextObject, // and return this object. Text = report.reportDefinition.reportObjects [ReportObjectname] as textObject; if (text! = Null) Return TEXT; Else Return null;

转载请注明原文地址:https://www.9cbs.com/read-22484.html

New Post(0)