コード例 #1
0
        private NameValueCollection CreateDeviceInfo(DeviceInfoCollection initialDeviceInfos, Report report, int pageNumber, string searchState, string replacementRoot, string linkTarget, string browserMode, bool useImageConsolidation, bool enablePowerBIFeatures)
        {
            NameValueCollection nameValueCollection = new NameValueCollection();

            foreach (DeviceInfo initialDeviceInfo in initialDeviceInfos)
            {
                nameValueCollection.Add(initialDeviceInfo.Name, initialDeviceInfo.Value);
            }
            nameValueCollection.Set("HTMLFragment", "true");
            nameValueCollection.Set("Section", pageNumber.ToString(CultureInfo.InvariantCulture));
            string value = ReportImageOperation.CreateUrl(report, this.m_viewerInstanceIdentifier, false);

            nameValueCollection.Set("StreamRoot", value);
            string value2 = ReportImageOperation.CreateUrl(report, this.m_viewerInstanceIdentifier, true);

            nameValueCollection.Set("ResourceStreamRoot", value2);
            nameValueCollection.Set("EnablePowerBIFeatures", enablePowerBIFeatures.ToString());
            //nameValueCollection.Set("ActionScript", this.ActionScriptMethod);
            if (!string.IsNullOrWhiteSpace(searchState))
            {
                nameValueCollection.Set("FindString", searchState);
            }
            if (!string.IsNullOrEmpty(replacementRoot))
            {
                nameValueCollection.Set("ReplacementRoot", replacementRoot);
            }
            nameValueCollection.Set("PrefixId", this.UniqueRenderingId);
            nameValueCollection.Set("StyleStream", "true");
            if (!string.IsNullOrEmpty(linkTarget))
            {
                nameValueCollection.Set("LinkTarget", linkTarget);
            }
            if (HttpContext.Current != null && HttpContext.Current.Request != null)
            {
                string userAgent = HttpContext.Current.Request.Headers["User-Agent"];
                if (userAgent != null)
                {
                    nameValueCollection.Set("UserAgent", userAgent);
                }
            }
            if (!string.IsNullOrEmpty(browserMode) && nameValueCollection["BrowserMode"] == null)
            {
                nameValueCollection.Set("BrowserMode", browserMode);
            }
            if (!useImageConsolidation)
            {
                nameValueCollection.Set("ImageConsolidation", "false");
            }
            return(nameValueCollection);
        }
コード例 #2
0
        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);
        }