예제 #1
0
        protected override bool InternalRender(Microsoft.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, ref Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
        {
            HtmlTextWriter htmlTextWriter = null;
            ServerRenderer serverRenderer = null;

            try
            {
                htmlTextWriter = HtmlWriterFactory.CreateWriter(report.Name, "text/html", createAndRegisterStream, StreamOper.CreateAndRegister);
                DeviceInfo deviceInfo2 = null;
                try
                {
                    deviceInfo2 = new ServerDeviceInfo();
                    deviceInfo2.ParseDeviceInfo(deviceInfo, clientCapabilities);
                }
                catch (ArgumentOutOfRangeException innerException)
                {
                    throw new ReportRenderingException(RenderRes.rrInvalidDeviceInfo, innerException);
                }
                bool onlyVisibleStyles = deviceInfo2.OnlyVisibleStyles;
                int  totalPages        = 0;
                if (renderProperties != null)
                {
                    object obj = renderProperties["ClientPaginationMode"];
                    if (obj != null)
                    {
                        PaginationMode paginationMode = (PaginationMode)obj;
                        if (paginationMode == PaginationMode.TotalPages)
                        {
                            object obj2 = renderProperties["PreviousTotalPages"];
                            if (obj2 != null && obj2 is int)
                            {
                                totalPages = (int)obj2;
                            }
                        }
                    }
                }
                if (deviceInfo2.BookmarkId != null)
                {
                    string uniqueName = null;
                    SPBInteractivityProcessing sPBInteractivityProcessing = new SPBInteractivityProcessing();
                    int section = sPBInteractivityProcessing.ProcessBookmarkNavigationEvent(report, totalPages, deviceInfo2.BookmarkId, out uniqueName);
                    if (uniqueName != null)
                    {
                        deviceInfo2.Section      = section;
                        deviceInfo2.NavigationId = uniqueName;
                    }
                }
                try
                {
                    serverRenderer = CreateRenderer(report, reportServerParameters, deviceInfo2, deviceInfo, clientCapabilities, createAndRegisterStream, ref renderProperties, totalPages);
                }
                catch (InvalidSectionException innerException2)
                {
                    throw new ReportRenderingException(innerException2);
                }
                serverRenderer.Render(htmlTextWriter);
                serverRenderer.UpdateRenderProperties(ref renderProperties);
                return(false);
            }
            finally
            {
                serverRenderer?.Dispose();
                htmlTextWriter?.Flush();
            }
        }
예제 #2
0
        protected override bool InternalRenderStream(string streamName, Microsoft.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, ref Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
        {
            if (streamName == null || streamName.Length <= 0)
            {
                return(false);
            }
            if (Microsoft.ReportingServices.Rendering.SPBProcessing.SPBProcessing.RenderSecondaryStream(report, createAndRegisterStream, streamName))
            {
                return(true);
            }
            char c = '_';

            char[] separator = new char[1]
            {
                c
            };
            string[] array = streamName.Split(separator);
            if (array.Length < 2)
            {
                return(false);
            }
            string text = report.Name + c + "style";

            if (streamName.StartsWith(text, StringComparison.Ordinal))
            {
                DeviceInfo deviceInfo2 = null;
                try
                {
                    deviceInfo2 = new ServerDeviceInfo();
                    deviceInfo2.ParseDeviceInfo(deviceInfo, clientCapabilities);
                }
                catch (ArgumentOutOfRangeException innerException)
                {
                    throw new ReportRenderingException(RenderRes.rrInvalidDeviceInfo, innerException);
                }
                if (streamName.Length > text.Length && deviceInfo2.Section == 0)
                {
                    int    result = 0;
                    string s      = streamName.Substring(text.Length + 1);
                    if (int.TryParse(s, out result))
                    {
                        deviceInfo2.Section = result;
                    }
                }
                if (!deviceInfo2.OnlyVisibleStyles || deviceInfo2.Section == 0)
                {
                    Stream            stream            = createAndRegisterStream(streamName, "css", Encoding.UTF8, "text/css", willSeek: false, StreamOper.CreateAndRegister);
                    HTMLStyleRenderer hTMLStyleRenderer = new HTMLStyleRenderer(report, createAndRegisterStream, deviceInfo2, null);
                    hTMLStyleRenderer.Render(stream);
                    stream.Flush();
                }
                else
                {
                    ServerRenderer serverRenderer = null;
                    try
                    {
                        serverRenderer = CreateRenderer(report, reportServerParameters, deviceInfo2, deviceInfo, clientCapabilities, createAndRegisterStream, ref renderProperties, 0);
                        serverRenderer.RenderStylesOnly(streamName);
                        serverRenderer.UpdateRenderProperties(ref renderProperties);
                    }
                    catch (InvalidSectionException innerException2)
                    {
                        throw new ReportRenderingException(innerException2);
                    }
                    finally
                    {
                        serverRenderer?.Dispose();
                    }
                }
                return(true);
            }
            return(false);
        }