Reporting services 将SSRS 2016报告嵌入另一个没有iFrame的网页?
Reporting services 2016(目前仅作为技术预览版提供)进行了重大升级,包括HTML5呈现和法规遵从性。见: 我的愿望是使用本机模式(没有Sharepoint或aspx,只有纯HTML5)将SSRS 2016报告嵌入到另一个网页中。 执行此操作的传统方式是使用iFrame。 这是一种折衷的方法,因为可以删除工具栏、隐藏参数等,但最终还是会失去对文档的很多控制。这是一个来自不同域的跨站点实现,因此我无法随心所欲地操作包含的iFrame文档 是否存在“本地”嵌入报表元素的正式方法? 我可以设想一个URL参数选项,比如Reporting services 将SSRS 2016报告嵌入另一个没有iFrame的网页?,reporting-services,ssrs-2016,Reporting Services,Ssrs 2016,Reporting services 2016(目前仅作为技术预览版提供)进行了重大升级,包括HTML5呈现和法规遵从性。见: 我的愿望是使用本机模式(没有Sharepoint或aspx,只有纯HTML5)将SSRS 2016报告嵌入到另一个网页中。 执行此操作的传统方式是使用iFrame。 这是一种折衷的方法,因为可以删除工具栏、隐藏参数等,但最终还是会失去对文档的很多控制。这是一个来自不同域的跨站点实现,因此我无法随心所欲地操作包含的iFrame文档 是否存在“本地”嵌入报表元素的正式方法?
rs:Format=REPORTDIV
,它为我提供了一个html元素
我还尝试以图像的形式获取报告(
rs:Format=image&rc:OutputFormat=PNG
),但生成的PNG在报告元素周围有一个巨大的白色边框(即使在报告生成器中将背景设置为透明时也是如此),这是不可行的。它应该在环境之外工作,并从内存中嵌入图像,而不是从数据库中获取图像
// Create service instance
ReportExecutionServiceSoapClient rsExec = new ReportExecutionServiceSoapClient(binding, endpoint);
rsExec.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
rsExec.ChannelFactory.Credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
ReportingServices.Extension[] extentions = null;
ReportingServices.TrustedUserHeader trustedUserHeader = new ReportingServices.TrustedUserHeader();
rsExec.ListRenderingExtensions(trustedUserHeader, out extentions);
string reportPath = "/Untitled";
ExecutionInfo execInfo = new ExecutionInfo();
ExecutionHeader execHeader = new ExecutionHeader();
ReportingServices.ServerInfoHeader serverInfo = new ReportingServices.ServerInfoHeader();
string historyID = null;
rsExec.LoadReport(trustedUserHeader, reportPath, historyID, out serverInfo, out execInfo);
//Get execution ID
execHeader.ExecutionID = execInfo.ExecutionID;
string deviceInfo = null;
string extension;
string encoding;
string mimeType;
ReportingServices.Warning[] warnings = new ReportingServices.Warning[1];
warnings[0] = new ReportingServices.Warning();
string[] streamIDs = null;
string format = "HTML5";
Byte[] result;
rsExec.Render(execHeader, trustedUserHeader, format, deviceInfo, out result, out extension, out mimeType, out encoding, out warnings, out streamIDs);
var report = Encoding.UTF8.GetString(result);
int streamIdCount = streamIDs.Length;
Byte[][] imageArray = new Byte[streamIdCount][];
String[] base64Images = new String[streamIdCount];
for (int i = 0; i <= streamIdCount - 1; i++)
{
Byte[] result2;
string streamId = streamIDs[i];
rsExec.RenderStream(execHeader, trustedUserHeader, format, streamId, deviceInfo, out result2, out encoding, out mimeType);
imageArray[i] = result2;
base64Images[i] = Convert.ToBase64String(result2);
string replace = string.Format("https://<reportserver>/ReportServer?%2FUntitled&rs%3ASessionID={0}&rs%3AFormat={1}&rs%3AImageID={2}", execInfo.ExecutionID, format, streamId);
string src = string.Format("data:{0};charset=utf-8;base64, {1}", mimeType, base64Images[i]);
report = report.Replace(replace, src);
}
//创建服务实例
ReportExecutionServiceSoapClient rsExec=新的ReportExecutionServiceSoapClient(绑定,端点);
rsExec.ClientCredentials.Windows.AllowedImpersonationLevel=System.Security.Principal.TokenImpersonationLevel.Impersonation;
rsExec.ChannelFactory.Credentials.Windows.ClientCredential=System.Net.CredentialCache.DefaultNetworkCredentials;
ReportingServices.Extension[]extensions=null;
ReportingServices.TrustedUserHeader TrustedUserHeader=新建ReportingServices.TrustedUserHeader();
ListRenderingExtensions(trustedUserHeader,out扩展名);
字符串reportPath=“/Untitled”;
ExecutionInfo ExecutionInfo=新的ExecutionInfo();
ExecutionHeader ExecutionHeader=新的ExecutionHeader();
ReportingServices.ServerInfoHeader serverInfo=新建ReportingServices.ServerInfoHeader();
字符串historyID=null;
LoadReport(trustedUserHeader、reportPath、historyID、out serverInfo、out execInfo);
//获取执行ID
execHeader.ExecutionID=execInfo.ExecutionID;
字符串deviceInfo=null;
字符串扩展;
字符串编码;
字符串模拟类型;
ReportingServices.Warning[]warnings=新的ReportingServices.warnings[1];
警告[0]=新的ReportingServices.Warning();
字符串[]streamIDs=null;
字符串格式=“HTML5”;
字节[]结果;
Render(execHeader、trustedUserHeader、format、deviceInfo、out result、out extension、out mimeType、out encoding、out warning、out streamid);
var report=Encoding.UTF8.GetString(结果);
int streamIdCount=streamIDs.Length;
字节[][]图像阵列=新字节[streamIdCount][];
String[]base64Images=新字符串[streamIdCount];
对于(int i=0;i)而言,到目前为止,唯一可行的方法似乎是将报告作为图像获取,然后通过sprite剪切它以适合您自己的web内容:请参阅。在IFrame Url中添加rs:Embed=true
似乎是“可行之道”。你能解决它吗?如果可以,请发布你的答案,这样我们都能从中学习,谢谢。不幸的是,我没有按照我想要的方式解决。我的第一条评论中详述的图像和精灵切割是我采用的解决方案。