社区
图表区
帖子详情
ReportDocument.PrintToPrinter打印水晶报表时报错:报表文件路径无效
IDreamFly
2018-04-04 10:26:41
PrintDocument prtdoc = new PrintDocument();
oRpt.PrintOptions.PrinterName = prtdoc.PrinterSettings.PrinterName;
oRpt.PrintToPrinter(1, true, 0, 0);
oRpt.Dispose();
...全文
527
1
打赏
收藏
ReportDocument.PrintToPrinter打印水晶报表时报错:报表文件路径无效
PrintDocument prtdoc = new PrintDocument(); oRpt.PrintOptions.PrinterName = prtdoc.PrinterSettings.PrinterName; oRpt.PrintToPrinter(1, true, 0, 0); oRpt.Dispose();
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
1 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dugupiaoyun
2018-08-29
打赏
举报
回复
oRpt是什么类型的?
CRRuntime_64_32bit_13_0_30.rar
解决VS开发的
水晶
报表
报错
问题,安装32位即可解决System.TypeInitializationException: “CrystalDecisions.Crystal
Report
s.Engine.
Report
Document
”的类型初始值设定项引发异常。 ---> CrystalDecisions.Crystal
Report
s.Engine.LoadSave
Report
Exception: An error has occurred while attempting to load the Crystal
Report
s runtime. Either the Crystal
Report
s registry key permissions are insufficient, or the Crystal
Report
s runtime is not installed correctly. Please install the ap
pr
o
pr
iate Crystal
Report
s redistributable (CRRedist*.msi) containing the correct version of the Crystal
Report
s runtime (x86, x64, or Itanium)
[C#.NET2005]VS2005中使用
水晶
报表
和
水晶
报表
使用指南 word格式
水晶
报表
是一个功能强大的
报表
工具,现在已经被Microsoft Visual Studio 2005(下文以VS2005简称)集成在一起。喜欢
水晶
报表
的朋友可以方便使用了。我把
水晶
报表
在vs2005的使用方法总结一下,供大家参考。 首先介绍一下我用的软件环境:Microsoft Visual Studio 2005;Microsoft SQL Server 2005 【数据用例】 服务器:SQLEX
PR
ESS 数据库名:Test 数据库表:T 数据: 图1 【说明】
水晶
报表
在应用
时
分两种方法,分别是拉模式(PULL)、推模式(PUSH)。拉模式:在
水晶
报表
生成
时
的数据源是从
水晶
报表
文件
中的SQL语句从数据库中提取的,在编程
时
不用重写SQL语句,但要加上登录信息(具体方法,后面介绍)。推模式:在
水晶
报表
生成
时
的数据源,是用编程
时
重写
水晶
报表
中SQL语句而生成的dataset对像。也就是说,推模式是用dataset组装
水晶
报表
。
水晶
报表
组件介绍。
水晶
报表
在VS2005中有两种组件,在WEB项目是分别是Crystal
Report
Source,Crystal
Report
Viewer。在FORM项目里是分别是crystal
Report
,Crystal
Report
Viewer。 Crystal
Report
Source,crystal
Report
是
水晶
报表
的数据提供者;Crystal
Report
Viewer是
水晶
报表
的浏览器。另外还要介绍一下水的
报表
的
文件
是以rpt为扩展名的
文件
,该
文件
可以用VS2005生成。 下面分别介绍具体操作方法: 拉模式(PULL): 在拉模式中如要在
水晶
报表
中的SQL语句加上条件参数
时
要用{?参数名}方式给出。例:“Select T1, T2, T3 FROM T Where T1='{?parm}'” parm就是参数名 以下例子中所用到的
水晶
报表
文件
中使用的SQL语句是“Select T1, T2, T3 FROM T Where T1='{?parm}'” parm就是参数名。 【WEB方式下】 using CrystalDecisions.Shared; using CrystalDecisions.Crystal
Report
s.Engine; ///
///功能:拉模式提取
水晶
报表
///个人主页:http://www.dzend.com/ ///
///
///
pr
otected void Button_pull_Click(object sender, EventArgs e) { // Crystal
Report
.rpt是
水晶
报表
文件
的名称;Crystal
Report
Source1是从工具箱加到页面上的
水晶
报表
数据源对像。 Crystal
Report
Source1.
Report
Document
.Load(Server.MapPath("Crystal
Report
.rpt")); // SetDatabaseLogon 拉模式中必须用这个方法来设置登录信息,参数一:用户名;参数二:密码;参数三:服务器;参数四:数据库名 Crystal
Report
Source1.
Report
Document
.SetDatabaseLogon("sa", "123456", @"SYWZSWL\SQLEX
PR
ESS", "Test"); //给
水晶
报表
传参数,参数一:是参数名,参数二:参数值; Crystal
Report
Source1.
Report
Document
.SetParameterValue("Title", "这是一个测试
报表
"); Crystal
Report
Source1.
Report
Document
.SetParameterValue("Parm", "1"); //绑定
水晶
报表
数据源。 Crystal
Report
Source1.DataBind(); // Crystal
Report
Viewer1是
水晶
报表
浏览器,下面是给该浏览器赋上对像 Crystal
Report
Viewer1.
Report
Source = Crystal
Report
Source1; Crystal
Report
Viewer1.DataBind(); }
水晶
报表
的两种传值方式
水晶
报表
的两种调用方式: 1.拉模式,2.推模式 拉模式: 1.模版中需要写入的代码: #region 绑定
报表
///
/// 绑定
报表
///
///
报表
名称 ///
SQL语句 ///
返回
Report
Document
对象
Report
Document
report
Document
= new
Report
Document
(); public
Report
Document
Crystal
Report
s(string P_str_c
report
Name, string P_str_sql) {
使用命令方式创建
水晶
报表
Crystal
Report
Source1.
Report
Document
.Load(Server.MapPath("mycry.rpt")); Crystal
Report
Source1.
Report
Document
.SetDataSource(myset .Tables [0]); Crystal
Report
Source1.DataBind(); Crystal
Report
Viewer1.
Report
Source = Crystal
Report
Source1; Crystal
Report
Viewer1.DataBind();
水晶
报表
中插入图片,已验证成功,就一个简单的方法。
水晶
报表
中插入图片,只提供方法,
水晶
报表
,无非就是在Microsoft Visual Studio 2005/08/10等里面拖拉控件。
水晶
报表
两个插件:Crystal
Report
Viewer、
Report
Document
图表区
4,816
社区成员
14,134
社区内容
发帖
与我相关
我的任务
图表区
.NET技术 图表区
复制链接
扫一扫
分享
社区描述
.NET技术 图表区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章