power bi报表服务器_如何将Power BI Report Server报表嵌入ASP.Net Web应用程序
power bi报表服务器
Every once in a while, teams from different functional areas of the business (i.e. business intelligence, software development, web development etc.) would join forces to form a cross-functional development team with a common goal of integrating a business intelligence artefact such as a SQL Server Reporting Services (SSRS) report into a front-end web application. There are many reasons for forming such a partnership including a lack of report-development skill by web developers, BI team owns a better reporting tool for data visualization, or maybe to prevent the software team from “reinventing the wheel” by developing a report that has already been produced elsewhere.
每隔一段时间,来自业务不同职能领域(即商业智能,软件开发,Web开发等)的团队将联手组成一个跨职能的开发团队,其共同目标是整合诸如SQL Server Reporting Services (SSRS)报告到前端Web应用程序。 建立这种伙伴关系的原因有很多,包括Web开发人员缺乏报表开发技能,BI团队拥有更好的数据可视化报表工具,或者可能是通过开发报表来防止软件团队“重塑方向”。已经在其他地方生产了。
Regardless of the reasons for forming cross-functional teams, you would often find that whilst many tutorials have been written about the integration of Power BI Service with .Net applications, there is currently very limited content on the internet pertaining to embedding the on-prem version of Power BI Service (known as Power BI Report Server) reports into .Net applications.
无论组建跨职能团队的原因是什么,您通常会发现,尽管已经撰写了许多有关Power BI Service与.Net应用程序集成的教程,但互联网上目前有关嵌入本地内容的内容非常有限版本的Power BI服务 (称为Power BI报表服务器 )将报表导入.Net应用程序。
I was recently involved in a project that required an integration of a Power BI Report Server dashboard with an ASP.NET MVC application. As you can imagine, having so limited content on the internet relating to this type of integration meant that my team and I had to think out of the box and play around with a few ideas to get the project delivered but we managed to complete the project and, in this article, I will share my limited expertise on how you can go about embedding a Power BI Report Server reports with ASP.NET web applications.
我最近参与了一个项目,该项目需要将Power BI Report Server仪表板与ASP.NET MVC应用程序集成在一起。 可以想像,与此类集成相关的互联网内容非常有限,这意味着我和我的团队必须开箱即用,并想出一些想法来交付项目,但我们设法完成了该项目并且,在本文中,我将分享我有限的专业知识,介绍如何将Power BI Report Server报表嵌入ASP.NET Web应用程序。
将SSRS报告嵌入ASP.NET网站 (Embed SSRS Report into an ASP.NET Website)
In a way, this article is really a comparative piece between the ease at which web developers used to embed SSRS reports into their ASP.NET applications versus the challenges of doing the same thing but against a Power BI ReportServer report. Thus, it is only fitting that before we proceed, we first look at how one went about integrating an SSRS report with ASP.NET applications.
从某种意义上说,本文确实是Web开发人员过去将SSRS报表嵌入其ASP.NET应用程序的难易程度与针对Power BI ReportServer报表进行相同操作所面临的挑战之间的比较。 因此,在继续之前,我们首先要看看如何将SSRS报告与ASP.NET应用程序集成。
There are plenty of resources over the internet that gives you a step-by-step guideline on how to embed an SSRS report into an ASP.NET web application. Generally, the trick is twofold – (assuming that you have already developed and deployed an SSRS report):
In order for an SSRS report to be successfully rendered in a web application, the web page must make use of the rsweb:ReportViewer element which references the assembly file Microsoft.ReportViewer.WebForms.dll. There are several ways that you can go about installing this assembly file, but the safest way would be to install it as a NuGet package.
Once installation of the assembly file is complete, you can then embed an SSRS report into an ASP.Net page by providing details of the report’s server name, processing mode, and file location as indicated in Figure 1.
Figure 2 gives us a preview of the web page we configured in Figure 1. As it can be seen, our sample SSRS report has successfully been embedded into the Default.aspx page.
将Power BI Report Server报表嵌入ASP.NET网站 (Embedding Power BI Report Server Report into ASP.NET Website)
Although the newer version of Report Server Configuration Manager has been modified to support configuration of both SSRS Report Server and Power BI Report Server, as shown in Figure 3, the ReportViewer control continues not to support the rendering of Power BI Report Server reports.
尽管已对新版本的Report Server Configuration Manager进行了修改,以支持SSRS Report Server和Power BI Report Server的配置 , 如图3所示,但是ReportViewer控件仍然不支持Power BI Report Server报表的呈现。
To demonstrate this limitation, I have created and successfully deployed a sample Power BI Report Server report as shown in Figure 4.
为了演示此限制,我创建并成功部署了一个示例Power BI Report Server报告, 如图4所示。
I next updated the links from my sample web application to point to my Power BI Report Server report as shown in Figure 5.
接下来,我更新了示例Web应用程序中的链接,以指向Power BI Report Server报告, 如图5所示。
This time when I run my ASP.NET web application, I receive an error message citing that an item of type Power BI Report Server report is not supported as shown in Figure 6.
这次,当我运行ASP.NET Web应用程序时,我收到一条错误消息, 指出不支持Power BI Report Server报告类型的项目, 如图6所示。
At this point, it is clear that when it comes to Power BI Report Server reports, we cannot simply reuse the same piece of code that we’ve previously turned to whenever we needed to embed an SSRS report into an ASP.Net web application. We, therefore, need to look out for other options that we can use to successfully embed reports hosted within an instance of Power BI Report Server. Fortunately, since, a Power BI Report Server report is essentially an HTML document, we have numerous HTML tags that we can use in ASP.Net application to embed a report.
至此,很明显,当涉及到Power BI Report Server报表时,无论何时需要将SSRS报表嵌入ASP.Net Web应用程序中时,我们都无法简单地重用以前使用的同一段代码。 因此,我们需要寻找可用于成功嵌入Power BI Report Server实例中托管的报表的其他选项。 幸运的是,由于Power BI Report Server报表本质上是HTML文档,因此我们可以在ASP.Net应用程序中使用许多HTML标记来嵌入报表。
选项#1:使用
Not only are iframes popular for embedding external content, they continue to be supported by major internet browsers. To demonstrate an integration of Power BI Report Server report within an iframe, I have edited the Default.aspx page of our sample web application shown in Figure 1 by replacing everything within the body tag with an iframe element that points to our sample Power BI Report Server report as shown in Figure 7.
iframe不仅因嵌入外部内容而广受欢迎,而且仍继续受到主要互联网浏览器的支持。 为了演示Power BI Report Server报告在iframe中的集成,我编辑了图1所示示例Web应用程序的Default.aspx页面,方法是将body标签中的所有内容替换为指向示例Power BI Report的iframe元素。 服务器报告如图7所示。
You will notice in Figure 7 that the link to our sample Power BI Report Server report has been suffixed with –?rs: embed=true. This is because in order for a Power BI Report Server report to be successfully embedded in your application, you need to set the rs:embed parameter to true.
您会在图7中注意到,到示例Power BI Report Server报告的链接已添加了后缀– ?rs:embed = true 。 这是因为为了将Power BI Report Server报告成功嵌入到您的应用程序中,您需要将rs:embed参数设置为true。
Figure 8 gives a preview of our web application when using an iframe. The left-hand side shows how the embedded page is rendered when the rs:embed parameter is not included in the URL whilst the right-hand side is a preview of the embedded Power BI Report Server whose URL has been suffixed with ?rs:embed=true.
图8给出了使用iframe时Web应用程序的预览。 左侧显示了URL中未包含rs:embed参数时如何呈现嵌入式页面,而右侧是URL带有后缀?rs:embed的嵌入式Power BI Report Server的预览。 = true 。
选项#2:使用
The object tag is usually used for displaying multimedia files within a web application. Unlike the iframe tag, the object tag might have limited browser support, especially when it comes to older versions of some browsers. Nevertheless, we can also use this HTML tag to embed a web page like a Power BI Report Server report by replacing a page’s body element with the following:
对象标记通常用于在Web应用程序中显示多媒体文件。 与iframe标签不同, 对象标签可能对浏览器的支持有限,尤其是在某些浏览器的较旧版本中。 尽管如此,我们也可以使用以下HTML标记通过将页面的body元素替换为以下内容来嵌入Web页面,如Power BI Report Server报告:
object>
选项#3:使用标记嵌入Power BI Report Server报告 (Option #3: Embed Power BI Report Server Report using an Tag)
The embed tag is also famous for rendering multimedia files but unlike the object tag, it has far fewer attributes that you can set on your own. For the purposes of embedding a Power BI Report Server report, we only need to set the src attribute as shown below:
embed标签还以呈现多媒体文件而闻名,但是与object标签不同,它具有更少的属性,您可以自行设置。 为了嵌入Power BI Report Server报表,我们只需要设置src属性,如下所示:
在Power BI报表服务器中隐藏筛选器面板 (Hide Filter Panel in Power BI Report Server)
The Power BI Report Server gives great comfort to organizations who are still reluctant to hosting their reports in the cloud. However, this version of Power BI doesn’t have similar features as its cloud-based counterpart. One missing feature is the ability to hide the filter panel button in your embedded report. Whilst the cloud implementation of this feature can be done by simply specifying query parameter &filterPaneEnabled=false, you need to play around with Cascading Style Sheets (CSS) to get this working against a Power BI Report Server report. The CSS workaround involves making the iframe that you will be using for embedding the report to being a responsive iframe. I’ve seen several sample scripts online about doing this, but the one that worked for me is from here, which basically involves defining your style sheet as shown below:
Power BI Report Server为仍然不愿在云中托管报告的组织提供了极大的舒适感。 但是,此版本的Power BI没有与基于云的版本相似的功能。 一种缺少的功能是能够在嵌入式报表中隐藏筛选器面板按钮的功能。 尽管可以通过简单地指定查询参数&filterPaneEnabled = false来完成此功能的云实现,但是您需要使用级联样式表 (CSS)才能使它针对Power BI Report Server报表起作用。 CSS解决方法涉及将要用于将报表嵌入到报表中的iframe变为自适应iframe。 我已经在网上看到了几个有关此操作的示例脚本,但是对我有用的一个是从这里开始的 ,它基本上涉及到定义样式表,如下所示:
Then you need to wrap your iframe within div tags, as shown below:
然后,您需要将iframe包装在div标签中,如下所示:
When you next run your web app, you will notice that the filter panel has been removed as shown in Figure 9.
1. If语句作为表达式
val properties = if (jobIdToActiveJob.contains(jobId)) {
jobIdToActiveJob(stage.jobId).properties
} else {
// this stage will be assigned to "default" po
基础测试题
卷面上不能出现任何的涂写文字,所有的答案要求写在答题纸上,考卷不得带走。
选择题
1、 What will happen when you attempt to compile and run the following code? (3)
public class Static {
static {
int x = 5; // 在static内有效
}
st
表里的一行对于一个数据块太大的情况有二种(一行在一个数据块里放不下)
第一种情况:
INSERT的时候,INSERT时候行的大小就超一个块的大小。Oracle把这行的数据存储在一连串的数据块里(Oracle Stores the data for the row in a chain of data blocks),这种情况称为行链接(Row Chain),一般不可避免(除非使用更大的数据
Follow up for "Remove Duplicates":What if duplicates are allowed at most twice?
For example,Given sorted array nums = [1,1,1,2,2,3],
Your function should return length