请问如何向水晶报表传值?如何在水晶报表中显示传过来的值?`````````````(winform -- 各位支持下新人) 如题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你先在报表中加入textobject 对象,然后通过reportDocument对象就可以访问了。/// <summary> /// 填充水晶报表数据 /// </summary> public void FillPrintData(string reportPath) { if (this.Parameters.ContainsKey("YSZID")) { this.YSZID = this.Parameters["YSZID"].ToString(); objPreSellLinence=new GESoft.FDJ.BusModules.wsba.Business.PreSellLinence(this.YSZID); dtBody=objPreSellLinence.GetBuildingListOfLicence().Tables[0].Copy(); rdGrantCertificate.Load(reportPath); //填充预售证表格信息 for(int row=0;row<dtBody.Rows.Count;row++) { for(int col =0;col<dtBody.Columns.Count;col++) { if(dtBody.Columns[col].ColumnName=="ZH") { string ctrName="to"; ctrName=ctrName+row.ToString()+"0"; ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString(); } if(dtBody.Columns[col].ColumnName=="DMCC") { string ctrName="to"; ctrName=ctrName+row.ToString()+"1"; ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString(); } if(dtBody.Columns[col].ColumnName=="FWYTMC") { string ctrName="to"; ctrName=ctrName+row.ToString()+"2"; ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString(); } if(dtBody.Columns[col].ColumnName=="ZJSMJ") { string ctrName="to"; ctrName=ctrName+row.ToString()+"3"; ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString(); } if(dtBody.Columns[col].ColumnName=="ZTS") { string ctrName="to"; ctrName=ctrName+row.ToString()+"4"; ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString(); } } } //填充预售证表头信息 ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCSellerName"])).Text=objPreSellLinence.DWMC; ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCProjectName"])).Text=objPreSellLinence.XMMC; GESoft.FDJ.BusModules.wsba.Business.Building objBuilding=new GESoft.FDJ.BusModules.wsba.Business.Building(); ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCLocation"])).Text=objBuilding.HouseSit(objPreSellLinence.LPZL); ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCUserforlife"])).Text=objPreSellLinence.KSRQ.ToString()+"--"+objPreSellLinence.ZZRQ.ToString(); ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toLinenceId"])).Text=objPreSellLinence.YSZH.ToString(); ((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toRe"])).Text=objPreSellLinence.BZ; crvGrantCertificate.PrintMode=CrystalDecisions.Web.PrintMode.ActiveX; crvGrantCertificate.ReportSource=rdGrantCertificate; } 建立水晶报表CR2,在CR2上放一个文本字段txtms.其他的看下面的代码.CR2 crt2=new CR2();TextObject getObjms;getObjms=crt2.ReportDefinition.ReportObjects["txtms"] as TextObject;getObjms.Text="区域销售汇总报表";没问题吧!要看不懂我就没法了. TextObject 需要引用什么? using CrystalDecisions.CrystalReports.Engine; 求教一个winform界面布局是如何实现的 正则表达式匹配问题 小问题难道我啊!这个图始终就是不居中?高手!纯前台! [WinForm] 动态添加控件添加后,怎么知道选择的是哪个控件 c#怎么删除某个对象关联的事件?? 关于线程的一个问题 各位大侠,Jmail组件pop3协议怎么接收附件啊??? DataGrid and DataSet的问题,请大家帮忙 用存储过程向数据库插入数据 关于小图片 四阶矩阵是否有逆矩阵的判断 200分求一个好的c#语言开发的开源的erp系统,哪位有的,给我一个!谢谢!
/// <summary>
/// 填充水晶报表数据
/// </summary>
public void FillPrintData(string reportPath)
{
if (this.Parameters.ContainsKey("YSZID"))
{
this.YSZID = this.Parameters["YSZID"].ToString();
objPreSellLinence=new GESoft.FDJ.BusModules.wsba.Business.PreSellLinence(this.YSZID);
dtBody=objPreSellLinence.GetBuildingListOfLicence().Tables[0].Copy();
rdGrantCertificate.Load(reportPath);
//填充预售证表格信息
for(int row=0;row<dtBody.Rows.Count;row++)
{
for(int col =0;col<dtBody.Columns.Count;col++)
{
if(dtBody.Columns[col].ColumnName=="ZH")
{
string ctrName="to";
ctrName=ctrName+row.ToString()+"0";
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString();
}
if(dtBody.Columns[col].ColumnName=="DMCC")
{
string ctrName="to";
ctrName=ctrName+row.ToString()+"1";
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString();
}
if(dtBody.Columns[col].ColumnName=="FWYTMC")
{
string ctrName="to";
ctrName=ctrName+row.ToString()+"2";
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString();
}
if(dtBody.Columns[col].ColumnName=="ZJSMJ")
{
string ctrName="to";
ctrName=ctrName+row.ToString()+"3";
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString();
}
if(dtBody.Columns[col].ColumnName=="ZTS")
{
string ctrName="to";
ctrName=ctrName+row.ToString()+"4";
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects[ctrName])).Text=dtBody.Rows[row][col].ToString();
}
}
}
//填充预售证表头信息
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCSellerName"])).Text=objPreSellLinence.DWMC;
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCProjectName"])).Text=objPreSellLinence.XMMC;
GESoft.FDJ.BusModules.wsba.Business.Building objBuilding=new GESoft.FDJ.BusModules.wsba.Business.Building();
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCLocation"])).Text=objBuilding.HouseSit(objPreSellLinence.LPZL);
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toCUserforlife"])).Text=objPreSellLinence.KSRQ.ToString()+"--"+objPreSellLinence.ZZRQ.ToString();
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toLinenceId"])).Text=objPreSellLinence.YSZH.ToString();
((TextObject)(rdGrantCertificate.ReportDefinition.Sections["Section3"].ReportObjects["toRe"])).Text=objPreSellLinence.BZ;
crvGrantCertificate.PrintMode=CrystalDecisions.Web.PrintMode.ActiveX;
crvGrantCertificate.ReportSource=rdGrantCertificate; }
其他的看下面的代码.
CR2 crt2=new CR2();TextObject getObjms;
getObjms=crt2.ReportDefinition.ReportObjects["txtms"] as TextObject;
getObjms.Text="区域销售汇总报表";
没问题吧!要看不懂我就没法了.