水日报表的使用小结
2005-08-19 10:05
761 查看
1.Engine:对引擎的支持类。定义了水晶报表里的各种对象及格式的设计;
2.shared:公用类。定义了被Engine等公用的类,如数据表登录信息,参数等,主要是一选项。
3.ReportSource:定义了报表的装载,导入,导出,打印,等属性,方法,事件。
4..Web:就要用来设置web端显示的一些属性。
小示例:
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;
CrystalDecisions.Shared.TableLogOnInfo logInfo=new TableLogOnInfo();
CrystalDecisions.CrystalReports.Engine.ReportDocument rp=new ReportDocument();
logInfo.ConnectionInfo.DatabaseName="ams";
logInfo.ConnectionInfo.ServerName="dyhcn";
logInfo.ConnectionInfo.UserID="sa";
logInfo.ConnectionInfo.Password="12345";
rp.Load(@"E:/AMS/baams/CrystalReport1.rpt");
rp.Database.Tables[0].ApplyLogOnInfo(logInfo);
this.CrystalReportViewer1.ReportSource=rp;
****************************************************************************************************************************
1.在aspx页面指定reportSource(这样总有错),只能在后台指定:
2.解决经典错误的办法如上代码所示,要手动建立TableLogonInfo和ReportDocumen两个类:
3.在TableLogonInfo中装配表的登陆信息,在ReportDocument中装入.rpt文件:
4.指定ReportDocument中涉及到的数据库各表的登陆信息:TableLogonInfo;
5.指定CrystalReportViewer的ReportSource为上述准备好的ReportDocument;
6.水晶报表的注册码为:注册号:6707437608 密码:AAP5GKS0000GDE100DS
7.导出word,excel,pdf等:
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();
diskOpts.DiskFileName = sDestFile;
oRpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
switch (sExportFormatType)
{
case "Mircrosoft Word 文档":
{
oRpt.ExportOptions.ExportFormatType = ExportFormatType.WordForWindows;
break;
}
case "Mircrosoft Excel 文档":
{
oRpt.ExportOptions.ExportFormatType = ExportFormatType.Excel;
break;
}
case "Adobe PDF 文档":
{
oRpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
break;
}
}
oRpt.ExportOptions.DestinationOptions = diskOpts;
oRpt.Export();
Response.ClearContent();
Response.ClearHeaders();
switch (sExportFormatType)
{
case "Mircrosoft Word 文档":
{
Response.ContentType = "application/msword";
break;
}
case "Mircrosoft Excel 文档":
{
Response.ContentType = "application/vnd.ms-excel";
break;
}
case "Adobe PDF 文档":
{
Response.ContentType = "application/pdf";
break;
}
}
Response.WriteFile(sDestFile);
Response.Flush();
Response.Close();
File.Delete(sDestFile);
相关文章推荐
- FusionChartsV3 做报表使用小结
- 水晶报表技术(11)——水晶报表使用小结
- C#水晶报表使用小结
- 项目--Combobox使用小结
- block使用小结、在arc中使用block、如何防止循环引用
- 使用MS图表控件创建基本报表
- android surfaceView与view使用小结
- CAT 使用小结
- winform 报表的基本使用
- iOS中GCD的使用小结
- virtualenv / venv 使用小结
- 树莓派使用小结
- 千万级报表测试利器,使用Datafactory V5.6快速构建测试数据
- 【Cocos2d游戏开发之十二】浅析使用C++/C/OC进行iOS游戏混编出现“failed with exit”问题与小结;
- VC++中使用,安装及部署水晶报表的方法
- ios之NSDictionary、NSMutableDictionary使用小结
- VS2015环境下Crystal Reports(水晶报表)的安装使用
- 关于FFMPEG使用小结
- 水晶报表使用总结
- Technorati使用小结