通过 Javascript 在页面中打印 Reporting Services

发布于 2024-08-30 21:29:59 字数 542 浏览 8 评论 0原文

我在 Sharepoint 2007 页面中有一个PerformancePoint Server 2007 仪表板。

在我的 Sharepoint 页面中,有 2 个过滤器传递到报告,我需要在页面中打印此报告(在另一个按钮中,而不是 SSRS 按钮中)。

因此,我需要一种调用 SSRS 打印按钮的 javascript 方法,该按钮位于 WebPartZone 内的命名 DIV 上,该 WebPartZone 中只有一个 WebPart,即 PerformancePoint 仪表板项(不知道 WebPart 的确切名称)。

编辑: 我注意到 PerformancePoint Server Web 部件显示的报告由我的 Sharepoint 页面中的 IFrame 显示。

编辑2: 由于我的架构,报告服务 Iframe 位于另一台服务器上,导致通过 javascript 访问时拒绝访问。 因此,我想要的问题不再可以回答,但是我会尝试直接在报告服务内回答问题,只是为了保持问题答案的准确性。

I Have a PerformancePoint Server 2007 Dashboard in a Sharepoint 2007 page.

In my Sharepoint page, there's 2 Filters who get passed to the Report, and I need to print this report in the page (in another button, not the SSRS one).

So what I need is a javascript method that calls the SSRS print button, which is on a named DIV, inside a WebPartZone that only have one WebPart, a PerformancePoint Dashboard Item (don't know the exact name of the webpart).

Edit:
I've noticed that the Report, that is shown by an PerformancePoint Server webpart, is being shown by an IFrame in my Sharepoint Page.

Edit2:
Due to my architecture the reporting services Iframe is on another server, causing Access Denied when accessing through javascript.
So the question in the way I wanted is not answerable anymore, however I'll try to answer the question directly inside the reporting services, just to keep the question answer accurate.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

┈┾☆殇 2024-09-06 21:29:59

打印按钮的 onclick 事件是 document.getElementById('ReportViewerControl').ClientController.LoadPrintControl();return false;,但是我未能成功地将其添加到报表查看器之外的另一个链接。这是有道理的,因为一页上可以有多个报告,并且每个报告都有一个打印按钮。

也许您可以尝试强制单击打印按钮?
document.getElementById('ReportViewerControl_ctl01_ctl07_ctl00_ctl00').onclick();
无论如何,在我的文档中。

The onclick event for the print button is document.getElementById('ReportViewerControl').ClientController.LoadPrintControl();return false;, however I was unsuccessful in just adding that to another link outside of the report viewer. That makes sense, since you can have multiple reports on a page and there's one print button for each.

Maybe you can try forcing a click of the print button?
document.getElementById('ReportViewerControl_ctl01_ctl07_ctl00_ctl00').onclick();
in my document, anyway.

指尖凝香 2024-09-06 21:29:59

解决了:
由于 SSRS 位于我的 Sharepoint 的 Iframe 内,我必须查看 Iframe 内部
(这仅在 Iframe 访问当前访问的网页的同一服务器时有效,否则我们将在 javascript 中拒绝访问并静默失败)
我使用 JQuery 使事情变得更简单,并使用 IE 8 来查找节点(因为 PerformancePoint Server 2007 没有出现在 Firefox 中)

Nathan 的 javascript 帮了我很多,我检查了按钮 html 结构,发现它是一个处理节点的表单击,该表有一个名为 title 的属性,其值名为 Print(请注意第一个字母的大写),因此我编写了这个小 JQuery Javascript 来解决此问题。

$('iframe').contents().find('table[title="Print"]').click();

请记住,这对我没有帮助,因为在我的情况下,SSRS 托管在另一台服务器上,因此无法通过 javascript 访问它,我刚刚完成了答案以帮助其他人解决这种情况。

Solved it:
Since the SSRS was inside an Iframe of my Sharepoint i had to look inside the Iframe
(this only works when the Iframe access the same server of the webpage currently accessed or else we will get a access denied in javascript and fail silently)
I used JQuery to make things simpler and used IE 8 to lookup the nodes (since PerformancePoint Server 2007 doesn't appear in Firefox)

Nathan's javascript helped me alot, I've checked the button html structure and find that it's a table that handle's the click and the table has a attribute called title with a value called Print (note the uppercase on the firt letter), so I written this little JQuery Javascript to solve this.

$('iframe').contents().find('table[title="Print"]').click();

remembering that this won't help me, because in my case the SSRS is hosted on another server, and therefore it's not accessible throught javascript, I've just completed the answer to help other people in this situation.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文