如何从应用程序加载RDL报告并以横向模式打印它 [英] How to load an RDL report and print it in Landscape mode from app

查看:100
本文介绍了如何从应用程序加载RDL报告并以横向模式打印它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在磁盘上保存了一个由fyiReporting工具创建的RDL报告(另存为a.RDL),该RDL文件已经包含要打印的数据(2个字段).

我要:

1.从应用程序中打印报告.

2.强制将打印设置为横向模式.

我找不到将.RDL加载为文档的方法-例如,下面的代码将打印一个空文档:

I have an RDL report created by fyiReporting tool already on disk (saved as a.RDL), The RDL file already contains the data to be printed (2 fields).

I want to:

1. Print the report from an application.

2. Force the print to Landscape mode.

I did not find a method to load .RDL as a document - For example, the code below prints an empty document:

PrintDocument pd = new PrintDocument();
pd.DocumentName(parmFileName).
pd.DocumentName = "a.doc"
pd.DefaultPageSettings.Landscape=true;
pd.Print();


我猜上面的代码正在创建一个新文档,而不是加载现有文档.

我想直接从磁盘打印现有的.

请帮忙.

问候,

EK


I guess the above code is creating a new document rather than loading the existing one.

I want to print the existing one from disk directly though.

Please help.

Regards,

EK

推荐答案

感谢您的反馈.
经过一些搜索和测试,我发现这可行:
Thanks for the feedback.
After some searching, and testing, I found that this works:
PrintDocument _pd = new PrintDocument();
RdlViewer _rdlViewer = new RdlViewer();
_pd.DefaultPageSettings.Landscape = true;
_rdlViewer.ReportName = parmFileName;
_rdlViewer.SourceFile = parmFileName;
_rdlViewer.Print(_pd);


[^ ]博客有一种打印rdl文件的方法,尽管它使用Reporting Services XML Web服务.

但是,我不确定您的报告是否会以非特定的方向正确显示.

如果您(或同事)创建了报告,则另一种选择是拥有两份报告,一份以纵向"设计,一份以横向"设计.然后只需打印适合情况的一个即可.
This[^] Blog has a method to print rdl files, although it uses the Reporting Services XML Web service.

However, I am not sure that your report will render correctly in an orientation that it was not designed for.

If you (or a colleague) created the report, then an alternative would be to have two reports, one designed in Portrait and one in Landscape. Then simply print the one appropriate to the circumstances.


这篇关于如何从应用程序加载RDL报告并以横向模式打印它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆