public static void Render(NameValueCollection deviceInfo, PageCountMode pageCountMode, ReportControlSession reportControlSession, AspNetCore.ReportingServices.Interfaces.CreateAndRegisterStream streamCallback, out string scrollScript, out string pageStyle)
        {
            TextWriter htmlTextWriter = null;

            try
            {
                deviceInfo.Add("OnlyVisibleStyles", "True");
                htmlTextWriter = LocalHtmlRenderer.CreateWriter(reportControlSession.Report.DisplayNameForUse, "text/html", streamCallback, AspNetCore.ReportingServices.Interfaces.StreamOper.CreateAndRegister);
                NameValueCollection      browserCaps = new NameValueCollection();
                ViewerRendererDeviceInfo viewerRendererDeviceInfo = new ViewerRendererDeviceInfo();
                viewerRendererDeviceInfo.ParseDeviceInfo(deviceInfo, new NameValueCollection());
                HTML5ViewerRenderer hTML5ViewerRenderer = new HTML5ViewerRenderer(reportControlSession, streamCallback, viewerRendererDeviceInfo, browserCaps, SecondaryStreams.Server, pageCountMode, null);
                hTML5ViewerRenderer.Render(htmlTextWriter);
                scrollScript = hTML5ViewerRenderer.FixedHeaderScript;
                //var stream=(streamCallback.Target as StreamCache).GetMainStream(true);
                //System.IO.StreamReader sr = new StreamReader(stream);
                //var html=sr.ReadToEnd();
                pageStyle = hTML5ViewerRenderer.PageStyle;
            }
            catch (LocalProcessingException)
            {
                throw;
            }
            catch (Exception renderingException)
            {
                throw renderingException;
            }
            finally
            {
                if (htmlTextWriter != null)
                {
                    htmlTextWriter.Flush();
                }
            }
        }
        public void RenderReportHTML(string deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, out string scrollScript, out string pageStyle)
        {
            var di   = ReportingServices.Diagnostics.RSRequestParameters.ShallowXmlToNameValueCollection(deviceInfo, "DeviceInfo");
            var info = Html.HTMLRenderer.CreateDeviceInfo(1, "", "", "", "", false, false);

            LocalHtmlRenderer.Render(CombineDeviceInfo(info, di), pageCountMode, this, createStreamCallback, out scrollScript, out pageStyle);
        }
Exemplo n.º 3
0
        protected virtual void LoadScriptFiles(List <byte> viewerScript)
        {
            string text = default(string);

            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.Common.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ToolbarImageHolder.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.HoverImage.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.StickyImage.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.InternalReportViewer.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ParameterInputControls.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.PromptArea.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ReportArea.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ReportPage.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.SessionKeepAlive.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ScriptStickyImage.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ScriptSwitchImage.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.TextButton.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.Toolbar.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ReportViewer.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ToolbarMenu.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.Splitter.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.ResizableBehavior.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.AsyncWaitControl.js", out text));
            viewerScript.AddRange(this.GetResource("AspNetCore.Reporting.Scripts.DocMapArea.js", out text));
            viewerScript.AddRange(LocalHtmlRenderer.GetResource("Common.js", out text));
            viewerScript.AddRange(LocalHtmlRenderer.GetResource("FitProportional.js", out text));
            viewerScript.AddRange(LocalHtmlRenderer.GetResource("FixedHeader.js", out text));
            viewerScript.AddRange(LocalHtmlRenderer.GetResource("CanGrowFalse.js", out text));
            viewerScript.AddRange(LocalHtmlRenderer.GetResource("ImageConsolidation.js", out text));
        }
        public static TextWriter CreateWriter(string streamName, string mimeType, AspNetCore.ReportingServices.Interfaces.CreateAndRegisterStream createStreamCallback, AspNetCore.ReportingServices.Interfaces.StreamOper streamOper)
        {
            Stream stream = LocalHtmlRenderer.CreateHTMLStream(streamName, mimeType, createStreamCallback, streamOper);

            TextWriter textWriter = new StreamWriter(stream, new UTF8Encoding(false));

            textWriter.NewLine = null;
            return(textWriter);
        }
 public Stream RenderReportHTML(NameValueCollection deviceInfo, PageCountMode pageCountMode, out string scrollScript, out string pageStyle)
 {
     this.m_htmlStreamCache.Clear();
     using (AspNetCore.Reporting.StreamCache streamCache = new AspNetCore.Reporting.StreamCache(this.CreateStreamCallback))
     {
         try
         {
             LocalHtmlRenderer.Render(deviceInfo, pageCountMode, this, this.GetStreamCallback(streamCache), out scrollScript, out pageStyle);
         }
         finally
         {
             streamCache.MoveSecondaryStreamsTo(this.m_htmlStreamCache);
         }
         return(streamCache.GetMainStream(true));
     }
 }
        public int RenderReport(ReportControlSession session, string viewerInstanceIdentifier, PageCountMode pageCountMode, int pageNumber, InteractivityPostBackMode interactivityMode, string searchState, string replacementRoot, string hyperlinkTarget, string alertMessage, DeviceInfoCollection initialDeviceInfos, string browserMode, bool sizeToContent)
        {
            if (this.m_reportStream != null)
            {
                throw new InvalidOperationException();
            }
            this.m_session = session;
            this.ViewIteration++;
            this.m_pageNumber = pageNumber;

            this.m_viewerInstanceIdentifier = viewerInstanceIdentifier;
            this.m_alertMessage             = alertMessage;
            this.m_interactivityMode        = interactivityMode;
            bool useImageConsolidation     = !sizeToContent;
            NameValueCollection deviceInfo = this.CreateDeviceInfo(initialDeviceInfos, session.Report, pageNumber, searchState, replacementRoot, hyperlinkTarget, browserMode, useImageConsolidation, this.EnableHybrid);

            this.m_reportStream        = session.RenderReportHTML(deviceInfo, pageCountMode, out this.m_scrollScript, out this.m_pageStyles);
            this.m_autoRefreshInterval = session.Report.AutoRefreshInterval;
            int totalPages = session.Report.GetTotalPages();

            if (this.m_pageNumber > totalPages)
            {
                this.m_pageNumber = totalPages;
            }
            this.m_autoRefreshInterval = session.Report.AutoRefreshInterval;
            if (sizeToContent)
            {
                this.m_scrollScript = null;
            }
            string styleStreamName = LocalHtmlRenderer.GetStyleStreamName(pageNumber);
            string text            = default(string);

            byte[] streamImage = session.GetStreamImage(styleStreamName, (string)null, out text);
            this.m_styleBytesString = null;
            if (streamImage != null && streamImage.Length > 0)
            {
                Encoding encoding = new UTF8Encoding(false);
                this.m_styleBytesString = encoding.GetString(streamImage);
            }
            return(this.m_pageNumber);
        }
 public byte[] GetRendererImage(string streamID, out string mimeType)
 {
     return(LocalHtmlRenderer.GetResource(streamID, out mimeType));
 }