reportserver

来源:互联网 发布:淘宝销量排行榜 编辑:程序博客网 时间:2024/05/20 22:01

1.       Report Viewer常用属性

a.       SizeToReportContent: 设置在报表呈现时,报表显示区域是否会随着报表内容改变大小。区别就是在报表高宽超过ReprotViewer和浏览器的高宽,TRUE会在浏览器上出现滚动条,FALSE仅在报表区域出现报表。

测试发现,只有width和height设置为100%时,才起作用。若设置为固定宽度则不管用。

 若异步模式设置为true,发现滚动条管用,但是高度只是页面的1/4.解决方法:Remove the xhtml doctype from the page.(将.aspx中的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">删除)

是否可以不删除,更改为html4.0?没测试。(dtd的用处:http://www.chinahtml.com/0710/119258363516578.html)

若异步模式设置为false,能全部显示,但是报表很窄,只占页面的部分,有点挤。

When you try to assign the web reportviewer control to a height of 100%, it displays as a very short (height wise) format.  For me, adding the style attributes to the form did the trick.

The solution to this problem was found on this page: http://msdn2.microsoft.com/en-us/library/ms252090.aspx.

Considerations for XHTML and ReportViewer Web Server Control

If you configure the ReportViewer Web server control to run in asynchronous mode in an application that is written in XHTML, you must follow specific steps to display the ReportViewer control properly. If the ReportViewer control uses relative height (for example, if the height is specified as a percentage of available space), the control collapses to a height of 0 pixels as a result of how frames and DIV tags render in containing tables in XHTML. You can avoid this problem by using one of the following workarounds:

  • Explicitly set the height on the on the ReportViewer control to an actual value rather than a percentage.

  • Add the following style setting to the head tag:

    <style>html,body,form {height:100%}</style>.

    By forcing the html, body and form tags to maximum height, the frame used in the ReportViewer control will also grow to maximum height, making it visible on the page.

  • 使用上面的方法,高度能显示全了,但是带有两个滚动条SizeToReportContent:不起作用。

     

  • Remove the xhtml doctype from the page.

b.      ProcessingMode: 设置ReportService是在本地还是远程。可选枚举值为:RemoteLocal

c.       AsyncRendering True / False,设置是否需要异步呈现。最好设为True,否则加载时会有卡的感觉。

2.       连接Report Service

ServerReprot属性用以设置远程ReportServerUrlReportPath。例:
rvReporting.ServerReport.ReportServerUrl = new Uri(“http://server/reportserver”);
rvReporting.ServerReport.ReportPath = “/Report/
消费分析”;

3.       连接凭据

a.       理论上可以配置IIS使用同名用户访问远程ReportServer,没有配成功。

b.      实现Microsoft.Reporting.WebForms. IReportServerCredentials,用以设置ServerReport. ReportServerCredentials。(代码附于文档最后)

4.       传入参数

a.       使用ServerReport.SetParameters方法设置报表参数。

b.      参数可以传入数组,但只能是字符串类型。即使Reprot中定义了非字符串的参数,这里也只能以String类型传入。引用报表是基于Soap的。

c.       参数区分大小写,必须和报表中设计的参数大小写一致,否则会抛出异常。

5.       问题汇总

a.       滚动条问题
设置SizeToReportContent会同时影响XY两个方向,如果只希望限制向一个方向扩展(即在报表内容超大时只出现某一个方向的滚动条,另一个方向自适应)无法通过设置完成。目前解决办法是使用JS轮询报表的状态,一旦状态改变,则重新设置报表内容的高度或宽度,以实现自适应效果。(代码附于文档最后)

b.      报表参数区分大小写,给报表传入参数时需要注意。

c.       在程序运行中出现异常{报表参数“[xx]”为只读,无法修改。 (rsReadOnlyReportParameter)},是由于在Report中指定了该参数为隐藏。

d.      异常{提供给报表参数“xx”的值对其类型无效。 (rsReportParameterTypeMismatch)},是由于给参数xx传入的值无法转换为xx定义的类型。比如int类型的数据传入了”abc”

原创粉丝点击