ssrs 报告渲染上的图像损坏

发布于 2024-08-22 04:53:43 字数 2202 浏览 5 评论 0原文

当我提交报告时,我很难显示图像。文本全部呈现良好,但图像显示为损坏。我该如何解决这个问题?

我的代码:

ReportExecutionServiceSoapClient rs = new ReportExecutionServiceSoapClient();
        rs.ClientCredentials.Windows.AllowedImpersonationLevel =
            System.Security.Principal.TokenImpersonationLevel.Impersonation;


        byte[] result = null;
        string encoding, mimeType, extension, DeviceInfo = null;
        ReportExecution2005.Warning[] warnings = null;
        string[] streamIds = null;

        DeviceInfo = "<DeviceInfo><StreamRoot>/Temp/Images/</StreamRoot><HTMLFragment>True</HTMLFragment></DeviceInfo>";
        //ReportExecution2005.LogonUserResponse luResp = LogonUserE();

        //rs.LogonUser()

        try
        {
            string historyId = null;
            ExecutionInfo executionInfo;
            ExecutionHeader executionHeader;
            ServerInfoHeader serverInfoHeader;

            List<ParameterValue> parameterValues = new List<ParameterValue>();
            ParameterValue param1= new ParameterValue();
            param1.Name = "Id";
            param1.Value = "17";
            ParameterValue year = new ParameterValue();
            year.Name = "Year";
            year.Value = "2009";
            ParameterValue region = new ParameterValue();
            region.Name = "RegionId";
            region.Value = "0";

            parameterValues.Add(param1);
            parameterValues.Add(year);
            parameterValues.Add(region);

            serverInfoHeader = rs.LogonUser("user", "pass", null);


            executionHeader = rs.LoadReport(null, ReportPath, historyId, out serverInfoHeader,
                                            out executionInfo);

            rs.SetExecutionParameters(executionHeader, null, parameterValues.ToArray(), "en-us", out executionInfo);


            rs.Render(executionHeader, null, "HTML4.0", DeviceInfo, out result, out extension, out mimeType,
                      out encoding, out warnings, out streamIds);


            report.InnerHtml = System.Text.Encoding.ASCII.GetString(result);

        }

        catch (SoapException ex)
        {


        }

I am having difficulty getting images to display when I render a report. The text all renders fine, but the images appears as broken. How do I fix this?

My code:

ReportExecutionServiceSoapClient rs = new ReportExecutionServiceSoapClient();
        rs.ClientCredentials.Windows.AllowedImpersonationLevel =
            System.Security.Principal.TokenImpersonationLevel.Impersonation;


        byte[] result = null;
        string encoding, mimeType, extension, DeviceInfo = null;
        ReportExecution2005.Warning[] warnings = null;
        string[] streamIds = null;

        DeviceInfo = "<DeviceInfo><StreamRoot>/Temp/Images/</StreamRoot><HTMLFragment>True</HTMLFragment></DeviceInfo>";
        //ReportExecution2005.LogonUserResponse luResp = LogonUserE();

        //rs.LogonUser()

        try
        {
            string historyId = null;
            ExecutionInfo executionInfo;
            ExecutionHeader executionHeader;
            ServerInfoHeader serverInfoHeader;

            List<ParameterValue> parameterValues = new List<ParameterValue>();
            ParameterValue param1= new ParameterValue();
            param1.Name = "Id";
            param1.Value = "17";
            ParameterValue year = new ParameterValue();
            year.Name = "Year";
            year.Value = "2009";
            ParameterValue region = new ParameterValue();
            region.Name = "RegionId";
            region.Value = "0";

            parameterValues.Add(param1);
            parameterValues.Add(year);
            parameterValues.Add(region);

            serverInfoHeader = rs.LogonUser("user", "pass", null);


            executionHeader = rs.LoadReport(null, ReportPath, historyId, out serverInfoHeader,
                                            out executionInfo);

            rs.SetExecutionParameters(executionHeader, null, parameterValues.ToArray(), "en-us", out executionInfo);


            rs.Render(executionHeader, null, "HTML4.0", DeviceInfo, out result, out extension, out mimeType,
                      out encoding, out warnings, out streamIds);


            report.InnerHtml = System.Text.Encoding.ASCII.GetString(result);

        }

        catch (SoapException ex)
        {


        }

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

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

发布评论

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

评论(1

最美的太阳 2024-08-29 04:53:43

您需要使用从 Render 方法返回的 StreamId 来调用 RenderStream 方法。

请参阅以下示例:http://ssrsphp.codeplex.com/

You'll need to call the RenderStream method using the streamIds that you get back from the Render method.

see the example at: http://ssrsphp.codeplex.com/

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