你真走运呀,我前几天好不容易琢磨出来的,给你:
1.添加引用:
using CrystalDecisions.CrystalReports.Engine;
2.写代码:
rpt_shoulspxfss aa =new rpt_shoulspxfss();//rpt_shoulspxfss:水晶报表的名称
TextObject bb=(TextObject)aa.ReportDefinition.ReportObjects["Text1"] ;
bb.Text ="水晶报表";
1.添加引用:
using CrystalDecisions.CrystalReports.Engine;
2.写代码:
rpt_shoulspxfss aa =new rpt_shoulspxfss();//rpt_shoulspxfss:水晶报表的名称
TextObject bb=(TextObject)aa.ReportDefinition.ReportObjects["Text1"] ;
bb.Text ="水晶报表";
就生成了一个报表文件CrystalReport1.rpt
2.
CrystalReport1替换pt_shoulspxfss
你好,报表很宽时,水晶报表的A4纸放不下(必须用A4),你有没有碰到过?该怎样处理?
再个,设计模式时我怎么知道我画的报表总共有几页?
using CrystalDecisions.CrystalReports.Engine;
…………
ReportDocument oRpt = new ReportDocument();
TextObject GetTextObject =(TextObject)oRpt.ReportDefinition.ReportObjects["TxtField1"];
GetTextObject.Text = "Test";
1.添加一个Web窗体-设为起始页
2.工具箱-添加一个CrystalReportViwer控件到web窗体
3.添加Crystal Report文件:“项目”-“添加新项”-“crystal report”-“确定”
4.双击解决方案资源管理器内的CrystalReport1.rpt->画一个文本框
5.双击你1步画的Web窗体,
a.添加引用:
using CrystalDecisions.CrystalReports.Engine;
b.在Page_load事件里加入::
CrystalReport1 aa =new CrystalReport1();
TextObject bb=(TextObject)aa.ReportDefinition.ReportObjects["Text1"] ;
bb.Text ="水晶报表";
CrystalReportViewer1.ReportSource=aa;
6.运行。
如果看不懂,请问你身边的高手,如果不能运行,我晕...哈哈哈哈
学习ReportDocument对象!