简体   繁体   English

从URL到Word的SSRS 2008呈现与从已在屏幕上呈现的报表导出提供不同的输出

[英]SSRS 2008 Rendering to Word from URL gives different output to Exporting from Report already rendered on screen

I have a report created in VS2008 on SQL Server 2008 (SP3). 我有一个在SQL Server 2008(SP3)上的VS2008中创建的报告。 The report comprises of several sub reports nested 3 or 4 levels down in some instances. 该报告包含一些子报告,在某些情况下,这些子报告向下嵌套3或4级。 Document Maps are used extensively so that Word Tables of Contents can be generated further down the line. 文档映射被广泛使用,以便可以进一步生成Word目录表。

Now here's the problem. 现在是问题所在。

If I render to screen either in the development environment or rendered the deployed report from the reporting services server, then everything is OK. 如果我在开发环境中进行渲染或从Reporting Services服务器中渲染已部署的报告,则一切正常。 If I export the report in any format (tested with Word, PDF & Excel) then the output is as expected. 如果我以任何格式(经Word,PDF和Excel测试)导出报告,则输出将如预期的那样。

However, if I create a URL including all the parameters something like 但是,如果我创建一个包含所有参数的URL,例如

http://MYSERVERNAME/ReportServer/Pages/ReportViewer.aspx?%2fMYPATH%2fMYREPORTNAME&PARAM1=999&PARAM2=999&PARAM3=999&rs:Command=Render&rs:Format=HTML4.0

then paste this into an IE window, the output is incorrect. 然后将其粘贴到IE窗口中,输出不正确。 Well let me clarify that. 好吧,让我澄清一下。

If I render as above using the HTML4.0 rendering extension then the report renders on screen as expected, all the content is shown. 如果我使用HTML4.0渲染扩展名按上述方式进行渲染,则报告将按预期方式在屏幕上进行渲染,将显示所有内容。 If I render to Word by changing the rs:Format parameter to Word then the report renders but the first page is missing (see note about this content below) If I render to PDF, the same part of the report is missing. 如果我通过将rs:Format参数更改为Word来呈现给Word,则报告将呈现,但是缺少第一页(请参阅下面有关此内容的注释)。如果我呈现为PDF,则报告的相同部分将丢失。 If I render to Excel, the document map generated on the first workbook sheet shows an entry for the missing section of report but clicking the click gives and 'invalid reference' error and indeed that part of the report is again not rendered. 如果我渲染到Excel,则在第一个工作簿工作表上生成的文档结构图将显示报告缺失部分的条目,但是单击单击会给出“无效参考”错误,并且实际上该报告的该部分也没有呈现。

Note that the 'master' report for want of a better term is made up of 3 subreports, each of these contain other sub reports. 请注意,缺少主用语的“主”报告由3个子报告组成,每个子报告都包含其他子报告。

Its the content of the first subreport, that also happens to only every show on the first page (as it is just less than a page long) that is missing. 它是第一个子报表的内容,也仅在缺少的第一页上的每个节目(因为它少于一页的长度)上发生。 In Word there is something rendered but it looks like an empty table with a width that is the full width of the page but a heigh of just a few millimetres. 在Word中,有一些呈现的东西,但它看起来像一个空表,其宽度等于页面的整个宽度,但高度只有几毫米。

I'm really at a loss as to why the section does not render when it works perfectly if rendered to screen and then exported. 我真的不知所措,为什么在渲染到屏幕然后导出时该部分无法完美显示的情况。 I had assumed they would use the same rendering process but I'm not sure. 我以为他们会使用相同的渲染过程,但不确定。

I'll continue to experiment, maybe add some blank content before the problem section or something and see where I get but I'm puzzled as to why this happens, other reports do not suffer the problem (however I have only tested 3 or 4 or the hundreds that I have written). 我将继续进行实验,也许在问题部分之前添加一些空白内容或其他内容,然后查看我的意思,但我对为什么会发生这种情况感到困惑,其他报告并未遇到问题(但是我只测试了3或4或我写的几百个)。 I've not used the URL method much in the past but I got to this point as I was writing ac# application to run the same report with varying parameters to produce over 1200 word documents, each of which takes about 2 mins to run. 我过去很少使用URL方法,但是到现在为止,我正在编写ac#应用程序,以运行具有不同参数的同一报表来生成1200多个word文档,每个文档运行大约2分钟。 the output was incorrect there so I worked my way back to creating a manual URL and the problem was still apparent, the rest is history! 那里的输出不正确,所以我回到了创建手动URL的方式,问题仍然很明显,剩下的就是历史了!

I finally found the answer. 我终于找到了答案。

The subreport that was causing the problems takes parameters that are subsequently passed on to other child subreports. 引起问题的子报表采用的参数随后将传递给其他子子报表。 While I was testing these, I had datasets that provided the available values for the parameters (list of countries and their associated ID's for example). 在测试这些数据时,我拥有的数据集提供了参数的可用值(例如,国家/地区列表及其关联的ID)。

My normal method of working is to remove all datasets that are only used to populate parameters in all subreports as this improves performance (the report does not have to query the database to get a list of countries for example). 我的正常工作方法是删除所有仅用于填充所有子报表中的参数的数据集,因为这可以提高性能(例如,报告不必查询数据库即可获取国家/地区列表)。

However, on this occasion I had removed all the datasets (which in itself was fine) but I had left the datasource in place (visible in the report data pane). 但是,在这种情况下,我删除了所有数据集(这本身很好),但是我将数据源留在了适当位置(在报告数据窗格中可见)。

Once I removed this redundant entry, the report rendered as expected. 一旦删除了此冗余条目,报告就会按预期呈现。

Now I'm still not sure why it rendered OK to HTML4.0 but it would appear that when rendering to other formats there is some process going on that looks at the datasource perhaps and as there is no data (as there are no datasets) then the report is not rendered. 现在,我仍然不确定为什么它可以将其呈现为HTML4.0,但是看起来当呈现为其他格式时,可能正在进行一些过程,该过程可能会查看数据源,并且因为没有数据(因为没有数据集)则报告不会呈现。 That's a bit of a guess but it's the only thing that makes sense to me at the moment. 这只是一个猜测,但这是目前对我来说唯一有意义的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM