Пример #1
0
        public Stream GetNextPage()
        {
            RPLReport rPLReport = null;

            this.m_createStream = true;
            return(this.GetNextPage(out rPLReport));
        }
Пример #2
0
        public Stream GetNextPage()
        {
            RPLReport rplReport = null;

            m_createStream = true;
            return(GetNextPage(out rplReport));
        }
Пример #3
0
        public void RenderRPLPage(RPLReport report, bool headerInBody, bool suppressOutlines)
        {
            string         key            = null;
            LayoutEngine   layoutEngine   = new LayoutEngine(report, headerInBody, this.m_streamDelegate);
            RPLPageContent rPLPageContent = report.RPLPaginatedPages[0];

            this.m_excel.GenerateWorksheetName(rPLPageContent.PageLayout.PageName);
            RPLReportSection nextReportSection = rPLPageContent.GetNextReportSection();

            this.AddBackgroundImage(rPLPageContent, nextReportSection);
            Reader.ReadReportMeasurements(report, layoutEngine, suppressOutlines, nextReportSection);
            try
            {
                layoutEngine.RenderPageToExcel(this.m_excel, key, this.m_sharedBorderCache, this.m_sharedImageCache);
                if (layoutEngine.ScalabilityCache != null)
                {
                    this.m_totalScaleTimeMs += layoutEngine.ScalabilityCache.ScalabilityDurationMs;
                    this.m_peakMemoryUsageKB = Math.Max(this.m_peakMemoryUsageKB, layoutEngine.ScalabilityCache.PeakMemoryUsageKBytes);
                }
            }
            finally
            {
                layoutEngine.Dispose();
            }
        }
Пример #4
0
            public Stream GetNextPage(out RPLReport rplReport)
            {
                string text       = "10.6";
                string deviceInfo = string.Format(CultureInfo.InvariantCulture, "<DeviceInfo><StartPage>{0}</StartPage><EndPage>{1}</EndPage><ToggleItems>{2}</ToggleItems><MeasureItems>{3}</MeasureItems><SecondaryStreams>{4}</SecondaryStreams><StreamNames>{5}</StreamNames><StreamRoot>{6}</StreamRoot><RPLVersion>{7}</RPLVersion><ImageConsolidation>{8}</ImageConsolidation></DeviceInfo>", new object[]
                {
                    this.m_spbContext.StartPage,
                    this.m_spbContext.EndPage,
                    this.m_spbContext.AddToggledItems,
                    this.m_spbContext.MeasureItems,
                    this.m_spbContext.SecondaryStreams.ToString(),
                    this.m_spbContext.AddSecondaryStreamNames,
                    this.m_streamRoot,
                    text,
                    this.m_spbContext.UseImageConsolidation
                });
                NameValueCollection nameValueCollection = new NameValueCollection();

                nameValueCollection.Add("rs:PageCountMode", this.m_pageCountMode.ToString());
                string text2;
                string text3;
                Stream stream = this.m_reportControlSession.RenderReport("RPL", true, deviceInfo, nameValueCollection, true, out text2, out text3);

                rplReport = null;
                if (stream == null || stream.Length <= 0L)
                {
                    if (stream != null)
                    {
                        stream.Dispose();
                    }
                    stream = null;
                    int totalPages = this.m_reportControlSession.Report.GetTotalPages();
                    if (totalPages < this.m_spbContext.EndPage)
                    {
                        this.m_spbContext.EndPage = totalPages;
                        if (this.m_spbContext.StartPage > this.m_spbContext.EndPage)
                        {
                            this.m_spbContext.StartPage = this.m_spbContext.EndPage;
                        }
                        deviceInfo = string.Format(CultureInfo.InvariantCulture, "<DeviceInfo><StartPage>{0}</StartPage><EndPage>{1}</EndPage><ToggleItems>{2}</ToggleItems><MeasureItems>{3}</MeasureItems><SecondaryStreams>{4}</SecondaryStreams><StreamNames>{5}</StreamNames><StreamRoot>{6}</StreamRoot><RPLVersion>{7}</RPLVersion><ImageConsolidation>{8}</ImageConsolidation></DeviceInfo>", new object[]
                        {
                            this.m_spbContext.StartPage,
                            this.m_spbContext.EndPage,
                            this.m_spbContext.AddToggledItems,
                            this.m_spbContext.MeasureItems,
                            this.m_spbContext.SecondaryStreams.ToString(),
                            this.m_spbContext.AddSecondaryStreamNames,
                            this.m_streamRoot,
                            text,
                            this.m_spbContext.UseImageConsolidation
                        });
                        stream = this.m_reportControlSession.RenderReport("RPL", true, deviceInfo, nameValueCollection, true, out text2, out text3);
                    }
                }
                if (stream != null && stream.Length > 0L)
                {
                    BinaryReader reader = new BinaryReader(stream, Encoding.Unicode);
                    rplReport = new RPLReport(reader);
                }
                return(stream);
            }
Пример #5
0
        public Stream GetNextPage(out RPLReport rplReport)
        {
            rplReport         = null;
            this.m_glyphCache = null;
            if (this.m_report.Done)
            {
                return(null);
            }
            if (this.m_selectiveRendering != null && this.m_selectiveRendering.Done)
            {
                return(null);
            }
            Stream    stream    = null;
            RPLWriter rPLWriter = null;

            this.IncrementPageNumber();
            if (this.m_startPage >= 0 && this.m_endPage >= 0 && (this.m_endPage == 0 || (this.m_pageContext.PageNumber >= this.m_startPage && this.m_pageContext.PageNumber <= this.m_endPage)))
            {
                rPLWriter = new RPLWriter();
                if (this.m_createStream)
                {
                    string name = this.m_pageContext.PageNumber.ToString(CultureInfo.InvariantCulture);
                    stream = this.m_createAndRegisterStream(name, "rpl", null, null, true, StreamOper.CreateOnly);
                    BufferedStream output        = new BufferedStream(stream);
                    BinaryWriter   binaryWriter2 = rPLWriter.BinaryWriter = new BinaryWriter(output, Encoding.Unicode);
                    binaryWriter2.Write("RPLIF");
                    this.WriteVersionStamp(binaryWriter2);
                }
            }
            if (this.m_selectiveRendering != null)
            {
                this.m_selectiveRendering.RenderReportItem(rPLWriter, this.m_paginationSettings.ReportItemPath);
            }
            else
            {
                this.m_report.NextPage(rPLWriter, this.m_totalPages);
            }
            if (rPLWriter != null)
            {
                this.m_glyphCache = rPLWriter.GlyphCache;
                if (this.m_createStream)
                {
                    this.WriteVersionStamp(rPLWriter.BinaryWriter);
                    rPLWriter.BinaryWriter.Flush();
                    rPLWriter = null;
                    BufferedStream input  = new BufferedStream(stream);
                    BinaryReader   reader = new BinaryReader(input, Encoding.Unicode);
                    rplReport = new RPLReport(reader);
                }
                else
                {
                    rplReport = rPLWriter.Report;
                }
            }
            return(stream);
        }
        public static Stream GetEmbeddedImageStream(RPLReport rplReport, long imageDataOffset, CreateAndRegisterStream createAndRegisterStream, string imageName)
        {
            Stream stream = null;

            if (imageDataOffset > 0)
            {
                stream = createAndRegisterStream(imageName, string.Empty, null, null, true, StreamOper.CreateOnly);
                rplReport.GetImage(imageDataOffset, stream);
            }
            return(stream);
        }
            private void WriteImpl()
            {
                Version   rPLVersion = new Version(10, 6, 0);
                RPLReport rPLReport  = new RPLReport();

                rPLReport.ReportName        = base.Report.Name;
                rPLReport.Description       = base.Report.Description;
                rPLReport.Author            = base.Report.Author;
                rPLReport.AutoRefresh       = base.Report.AutoRefresh;
                rPLReport.ExecutionTime     = base.Report.ExecutionTime;
                rPLReport.Location          = base.Report.Location.ToString();
                rPLReport.Language          = Microsoft.ReportingServices.Rendering.HPBProcessing.Report.GetReportLanguage(base.Report);
                rPLReport.RPLVersion        = rPLVersion;
                rPLReport.RPLPaginatedPages = new RPLPageContent[1];
                base.RplWriter.Report       = rPLReport;
                RPLReportSection rPLReportSection = new RPLReportSection(1);

                rPLReportSection.ID          = base.ReportSection.ID;
                rPLReportSection.ColumnCount = 1;
                RPLBody            rPLBody            = new RPLBody();
                RPLItemMeasurement rPLItemMeasurement = new RPLItemMeasurement();

                rPLItemMeasurement.Left          = 0f;
                rPLItemMeasurement.Top           = 0f;
                rPLItemMeasurement.Width         = base.Width;
                rPLItemMeasurement.Height        = base.Height;
                rPLItemMeasurement.ZIndex        = 0;
                rPLItemMeasurement.State         = 0;
                rPLItemMeasurement.Element       = rPLBody;
                rPLReportSection.Columns[0]      = rPLItemMeasurement;
                rPLReportSection.BodyArea        = new RPLMeasurement();
                rPLReportSection.BodyArea.Top    = 0f;
                rPLReportSection.BodyArea.Height = base.Height;
                m_pageItem.WriteStartItemToStream(base.RplWriter, base.PageContext);
                RPLItemMeasurement[] array2 = rPLBody.Children = new RPLItemMeasurement[1];
                array2[0] = m_pageItem.WritePageItemSizes();
                RPLPageLayout rPLPageLayout = new RPLPageLayout();

                rPLPageLayout.PageHeight = base.Height;
                rPLPageLayout.PageWidth  = base.Width;
                rPLPageLayout.Style      = new RPLElementStyle(null, null);
                RPLPageContent rPLPageContent = new RPLPageContent(1, rPLPageLayout);
                RPLMeasurement rPLMeasurement = new RPLMeasurement();

                rPLMeasurement.Left   = 0f;
                rPLMeasurement.Top    = 0f;
                rPLMeasurement.Width  = base.Width;
                rPLMeasurement.Height = base.Height;
                rPLPageContent.ReportSectionSizes[0] = rPLMeasurement;
                rPLPageContent.AddReportSection(rPLReportSection);
                base.RplWriter.Report.RPLPaginatedPages[0] = rPLPageContent;
            }
Пример #8
0
        internal HeaderFooterLayout(RPLReport report, float aWidth, float aHeight)
            : base(report)
        {
            m_fullList = new List <ReportItemInfo>();
            int num = LayoutConvert.ConvertMMTo20thPoints(aWidth);

            m_height      = aHeight;
            m_centerWidth = num / 3;
            m_rightWidth  = m_centerWidth * 2;
            m_leftList    = new List <ReportItemInfo>();
            m_centerList  = new List <ReportItemInfo>();
            m_rightList   = new List <ReportItemInfo>();
        }
Пример #9
0
        public HeaderFooterLayout(RPLReport report, float aWidth, float aHeight)
            : base(report)
        {
            this.m_fullList = new List <ReportItemInfo>();
            int num = LayoutConvert.ConvertMMTo20thPoints((double)aWidth);

            this.m_height      = aHeight;
            this.m_centerWidth = num / 3;
            this.m_rightWidth  = this.m_centerWidth * 2;
            this.m_leftList    = new List <ReportItemInfo>();
            this.m_centerList  = new List <ReportItemInfo>();
            this.m_rightList   = new List <ReportItemInfo>();
        }
Пример #10
0
        private void WriteStartItemToRPLOM(RPLWriter rplWriter, string language)
        {
            RPLReport rPLReport = new RPLReport();

            rPLReport.ReportName    = this.m_report.Name;
            rPLReport.Description   = this.m_report.Description;
            rPLReport.Author        = this.m_report.Author;
            rPLReport.AutoRefresh   = this.m_report.AutoRefresh;
            rPLReport.ExecutionTime = this.m_report.ExecutionTime;
            rPLReport.Location      = this.m_report.Location.ToString();
            rPLReport.Language      = language;
            rPLReport.RPLVersion    = this.m_rplVersion;
            rPLReport.ConsumeContainerWhitespace = this.m_report.ConsumeContainerWhitespace;
            rPLReport.RPLPaginatedPages          = new RPLPageContent[1];
            rPLReport.RPLPaginatedPages[0]       = new RPLPageContent(1);
            rplWriter.Report = rPLReport;
        }
 public static bool GetImage(RPLReport rplReport, ref byte[] imageData, long imageDataOffset)
 {
     if (imageData != null)
     {
         return(true);
     }
     if (imageDataOffset <= 0)
     {
         return(false);
     }
     imageData = rplReport.GetImage(imageDataOffset);
     if (imageData == null)
     {
         return(false);
     }
     return(true);
 }
 public static bool GetImage(RPLReport rplReport, ref byte[] imageData, long imageDataOffset, ref GDIImageProps gdiImageProps)
 {
     if (SharedRenderer.GetImage(rplReport, ref imageData, imageDataOffset))
     {
         if (gdiImageProps == null)
         {
             try
             {
                 using (Image image = Image.FromStream(new MemoryStream(imageData)))
                 {
                     gdiImageProps = new GDIImageProps(image);
                 }
             }
             catch
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Пример #13
0
        internal void RenderStrings(RPLReport report, IExcelGenerator excel, out string left, out string center, out string right)
        {
            foreach (ReportItemInfo full in m_fullList)
            {
                RPLPageLayout rPLPageLayout = full.RPLSource as RPLPageLayout;
                if (rPLPageLayout != null)
                {
                    continue;
                }
                RPLTextBox   rPLTextBox = full.RPLSource as RPLTextBox;
                RPLItemProps rPLItemProps;
                byte         elementType;
                if (rPLTextBox != null)
                {
                    if (rPLTextBox.StartOffset > 0)
                    {
                        rPLItemProps = m_report.GetItemProps(rPLTextBox.StartOffset, out elementType);
                    }
                    else
                    {
                        rPLItemProps = (RPLItemProps)rPLTextBox.ElementProps;
                        elementType  = 7;
                    }
                }
                else
                {
                    rPLItemProps = m_report.GetItemProps(full.RPLSource, out elementType);
                }
                if (elementType == 7)
                {
                    full.Values = (RPLTextBoxProps)rPLItemProps;
                    RPLElementStyle     style = rPLItemProps.Style;
                    HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left;
                    object obj = style[25];
                    if (obj != null)
                    {
                        horizontalAlignment = LayoutConvert.ToHorizontalAlignEnum((RPLFormat.TextAlignments)obj);
                    }
                    int    num   = 0;
                    int    num2  = 0;
                    string text  = (string)rPLItemProps.Style[15];
                    string text2 = (string)rPLItemProps.Style[16];
                    if (text != null)
                    {
                        num = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text));
                    }
                    if (text2 != null)
                    {
                        num2 = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text2));
                    }
                    switch (horizontalAlignment)
                    {
                    case HorizontalAlignment.Left:
                        full.AlignmentPoint = full.Left + num;
                        break;

                    case HorizontalAlignment.Right:
                        full.AlignmentPoint = full.Right - num2;
                        break;

                    default:
                        full.AlignmentPoint = full.Left + (full.Right - full.Left + num - num2) / 2;
                        break;
                    }
                    if (full.AlignmentPoint < m_centerWidth)
                    {
                        m_leftList.Add(full);
                    }
                    else if (full.AlignmentPoint < m_rightWidth)
                    {
                        m_centerList.Add(full);
                    }
                    else
                    {
                        m_rightList.Add(full);
                    }
                }
            }
            m_leftList.Sort(ReportItemInfo.CompareTopsThenLefts);
            m_centerList.Sort(ReportItemInfo.CompareTopsThenLefts);
            m_rightList.Sort(ReportItemInfo.CompareTopsThenLefts);
            left   = RenderString(m_leftList, excel);
            center = RenderString(m_centerList, excel);
            right  = RenderString(m_rightList, excel);
        }
Пример #14
0
 public RPLWriter(BinaryWriter binaryWriter, RPLReport report, RPLTablixRow tablixRow)
 {
     this.BinaryWriter = binaryWriter;
     this.Report       = report;
     this.TablixRow    = tablixRow;
 }
        protected override void Render(AspNetCore.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
        {
            PaginationSettings paginationSettings = new PaginationSettings(report, deviceInfo);
            string             text = paginationSettings.OutputFormat.ToString().ToUpperInvariant();
            bool flag = true;

            if (text == "TIFF")
            {
                text = "TIF";
                flag = false;
            }
            else if (text == "EMFPLUS")
            {
                text = "EMF";
            }
            if (text == "EMF")
            {
                paginationSettings.DynamicImageDpiX = 96;
                paginationSettings.DynamicImageDpiY = 96;
                paginationSettings.DpiX             = this.m_printDpiX;
                paginationSettings.DpiY             = this.m_printDpiY;
                int measureImageDpiX = default(int);
                int measureImageDpiY = default(int);
                ImageWriter.GetScreenDpi(out measureImageDpiX, out measureImageDpiY);
                paginationSettings.MeasureImageDpiX = measureImageDpiX;
                paginationSettings.MeasureImageDpiY = measureImageDpiY;
            }
            else
            {
                paginationSettings.MeasureImageDpiX = paginationSettings.DpiX;
                paginationSettings.MeasureImageDpiY = paginationSettings.DpiY;
            }
            paginationSettings.MeasureTextDpi = paginationSettings.DpiX;
            Stream stream = default(Stream);

            using (HPBProcessing.HPBProcessing hPBProcessing = new HPBProcessing.HPBProcessing(report, paginationSettings, createAndRegisterStream, ref renderProperties))
            {
                hPBProcessing.SetContext(hPBProcessing.PaginationSettings.StartPage, hPBProcessing.PaginationSettings.EndPage);
                using (Renderer renderer = new Renderer(true))
                {
                    stream = createAndRegisterStream(report.Name + (flag ? ('_' + hPBProcessing.PaginationSettings.StartPage.ToString(CultureInfo.InvariantCulture)) : ""), text, null, "image/" + text, !flag, StreamOper.CreateAndRegister);
                    using (ImageWriter imageWriter = new ImageWriter(renderer, stream, false, createAndRegisterStream, paginationSettings.MeasureImageDpiX, paginationSettings.MeasureImageDpiY))
                    {
                        imageWriter.OutputFormat = hPBProcessing.PaginationSettings.OutputFormat;
                        hPBProcessing.PaginationSettings.UseGenericDefault = !imageWriter.IsEmf;
                        imageWriter.BeginReport(hPBProcessing.PaginationSettings.DpiX, hPBProcessing.PaginationSettings.DpiY);
                        int num = hPBProcessing.PaginationSettings.StartPage;
                        while (true)
                        {
                            RPLReport rPLReport = default(RPLReport);
                            hPBProcessing.GetNextPage(out rPLReport);
                            if (rPLReport == null)
                            {
                                break;
                            }
                            if (flag && num > hPBProcessing.PaginationSettings.StartPage)
                            {
                                stream = (imageWriter.OutputStream = createAndRegisterStream(report.Name + '_' + num, text, null, "image/" + text, !flag, StreamOper.CreateForPersistedStreams));
                            }
                            renderer.ProcessPage(rPLReport, num, hPBProcessing.SharedFontCache, hPBProcessing.GlyphCache);
                            rPLReport.Release();
                            rPLReport = null;
                            num++;
                        }
                        imageWriter.EndReport();
                    }
                }
            }
            stream.Flush();
        }
Пример #16
0
 public void WriteStartItemToStream(RPLWriter rplWriter)
 {
     if (rplWriter != null)
     {
         BinaryWriter binaryWriter   = rplWriter.BinaryWriter;
         string       reportLanguage = Report.GetReportLanguage(this.m_report);
         if (binaryWriter != null)
         {
             Stream baseStream = binaryWriter.BaseStream;
             this.m_offset = baseStream.Position;
             binaryWriter.Write((byte)0);
             binaryWriter.Write((byte)2);
             if (this.m_report.Name != null)
             {
                 binaryWriter.Write((byte)15);
                 binaryWriter.Write(this.m_report.Name);
             }
             if (this.m_report.Description != null)
             {
                 binaryWriter.Write((byte)9);
                 binaryWriter.Write(this.m_report.Description);
             }
             if (this.m_report.Author != null)
             {
                 binaryWriter.Write((byte)13);
                 binaryWriter.Write(this.m_report.Author);
             }
             if (this.m_report.AutoRefresh > 0)
             {
                 binaryWriter.Write((byte)14);
                 binaryWriter.Write(this.m_report.AutoRefresh);
             }
             DateTime executionTime = this.m_report.ExecutionTime;
             binaryWriter.Write((byte)12);
             binaryWriter.Write(executionTime.ToBinary());
             ReportUrl location = this.m_report.Location;
             if (location != null)
             {
                 binaryWriter.Write((byte)10);
                 binaryWriter.Write(location.ToString());
             }
             if (reportLanguage != null)
             {
                 binaryWriter.Write((byte)11);
                 binaryWriter.Write(reportLanguage);
             }
             binaryWriter.Write((byte)255);
             this.m_pageOffset = baseStream.Position;
             binaryWriter.Write((byte)19);
             binaryWriter.Write((byte)3);
             binaryWriter.Write((byte)16);
             binaryWriter.Write((float)this.m_pageSettings.PhysicalPageHeight);
             binaryWriter.Write((byte)17);
             binaryWriter.Write((float)this.m_pageSettings.PhysicalPageWidth);
             binaryWriter.Write((byte)20);
             binaryWriter.Write((float)this.m_pageSettings.MarginBottom);
             binaryWriter.Write((byte)19);
             binaryWriter.Write((float)this.m_pageSettings.MarginLeft);
             binaryWriter.Write((byte)21);
             binaryWriter.Write((float)this.m_pageSettings.MarginRight);
             binaryWriter.Write((byte)18);
             binaryWriter.Write((float)this.m_pageSettings.MarginTop);
             ReportSectionPage reportSectionPage = new ReportSectionPage(((ReportElementCollectionBase <AspNetCore.ReportingServices.OnDemandReportRendering.ReportSection>) this.m_report.ReportSections)[0].Page);
             reportSectionPage.WriteItemStyle(rplWriter, this.m_pageContext);
             binaryWriter.Write((byte)255);
         }
         else
         {
             RPLReport rPLReport = new RPLReport();
             rPLReport.ReportName        = this.m_report.Name;
             rPLReport.Description       = this.m_report.Description;
             rPLReport.Author            = this.m_report.Author;
             rPLReport.AutoRefresh       = this.m_report.AutoRefresh;
             rPLReport.ExecutionTime     = this.m_report.ExecutionTime;
             rPLReport.Location          = this.m_report.Location.ToString();
             rPLReport.Language          = reportLanguage;
             rPLReport.RPLVersion        = this.m_rplVersion;
             rPLReport.RPLPaginatedPages = new RPLPageContent[1];
             rplWriter.Report            = rPLReport;
         }
     }
 }
 public bool Render(AspNetCore.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection reportServerParameters, NameValueCollection deviceInfo, NameValueCollection clientCapabilities, ref Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
 {
     try
     {
         this.ParseDeviceinfo(deviceInfo);
         Stream     output     = this.CreateFinalOutputStream(report.Name, createAndRegisterStream);
         MainEngine mainEngine = new MainEngine(createAndRegisterStream, this);
         if (report.HasDocumentMap && !this.m_omitDocumentMap)
         {
             this.m_addedDocMap = mainEngine.AddDocumentMap(report.DocumentMap);
             if (this.m_addedDocMap)
             {
                 mainEngine.NextPage();
             }
         }
         using (AspNetCore.ReportingServices.Rendering.SPBProcessing.SPBProcessing sPBProcessing = new AspNetCore.ReportingServices.Rendering.SPBProcessing.SPBProcessing(report, createAndRegisterStream, 1.7976931348623157E+308))
         {
             SPBContext sPBContext = new SPBContext();
             sPBContext.StartPage               = 0;
             sPBContext.EndPage                 = 0;
             sPBContext.MeasureItems            = false;
             sPBContext.AddSecondaryStreamNames = true;
             sPBContext.AddToggledItems         = true;
             sPBContext.AddOriginalValue        = true;
             sPBProcessing.SetContext(sPBContext);
             RPLReport rPLReport = null;
             bool      flag      = true;
             while (!sPBProcessing.Done)
             {
                 sPBProcessing.GetNextPage(out rPLReport);
                 if (rPLReport != null)
                 {
                     if (flag)
                     {
                         flag = false;
                         if (sPBProcessing.Done)
                         {
                             mainEngine.AdjustFirstWorksheetName(report.Name, this.m_addedDocMap);
                         }
                     }
                     else
                     {
                         mainEngine.NextPage();
                     }
                     mainEngine.RenderRPLPage(rPLReport, !this.m_simplePageHeaders, this.m_suppressOutlines);
                     rPLReport.Release();
                     rPLReport = null;
                 }
             }
             mainEngine.Save(output);
         }
         if (report.JobContext != null)
         {
             IJobContext jobContext = report.JobContext;
             lock (jobContext.SyncRoot)
             {
                 if (jobContext.AdditionalInfo.ScalabilityTime == null)
                 {
                     jobContext.AdditionalInfo.ScalabilityTime = new ScaleTimeCategory();
                 }
                 jobContext.AdditionalInfo.ScalabilityTime.Rendering = mainEngine.TotalScaleTimeMs;
                 if (jobContext.AdditionalInfo.EstimatedMemoryUsageKB == null)
                 {
                     jobContext.AdditionalInfo.EstimatedMemoryUsageKB = new EstimatedMemoryUsageKBCategory();
                 }
                 jobContext.AdditionalInfo.EstimatedMemoryUsageKB.Rendering = mainEngine.PeakMemoryUsageKB;
             }
         }
         mainEngine.Dispose();
         return(false);
     }
     catch (ReportRenderingException)
     {
         throw;
     }
     catch (Exception ex2)
     {
         if (AsynchronousExceptionDetection.IsStoppingException(ex2))
         {
             throw;
         }
         throw new ReportRenderingException(ex2, true);
     }
 }
Пример #18
0
        internal void WriteStartItemToStream(RPLWriter rplWriter)
        {
            if (rplWriter == null)
            {
                return;
            }
            BinaryWriter binaryWriter   = rplWriter.BinaryWriter;
            string       reportLanguage = GetReportLanguage(m_report);

            if (binaryWriter != null)
            {
                Stream baseStream = binaryWriter.BaseStream;
                m_offset = baseStream.Position;
                binaryWriter.Write((byte)0);
                binaryWriter.Write((byte)2);
                if (m_report.Name != null)
                {
                    binaryWriter.Write((byte)15);
                    binaryWriter.Write(m_report.Name);
                }
                if (m_report.Description != null)
                {
                    binaryWriter.Write((byte)9);
                    binaryWriter.Write(m_report.Description);
                }
                if (m_report.Author != null)
                {
                    binaryWriter.Write((byte)13);
                    binaryWriter.Write(m_report.Author);
                }
                if (m_report.AutoRefresh > 0)
                {
                    binaryWriter.Write((byte)14);
                    binaryWriter.Write(m_report.AutoRefresh);
                }
                DateTime executionTime = m_report.ExecutionTime;
                binaryWriter.Write((byte)12);
                binaryWriter.Write(executionTime.ToBinary());
                ReportUrl location = m_report.Location;
                if (location != null)
                {
                    binaryWriter.Write((byte)10);
                    binaryWriter.Write(location.ToString());
                }
                if (reportLanguage != null)
                {
                    binaryWriter.Write((byte)11);
                    binaryWriter.Write(reportLanguage);
                }
                binaryWriter.Write(byte.MaxValue);
                m_pageOffset = baseStream.Position;
                binaryWriter.Write((byte)19);
                binaryWriter.Write((byte)3);
                binaryWriter.Write((byte)16);
                binaryWriter.Write((float)m_pageSettings.PhysicalPageHeight);
                binaryWriter.Write((byte)17);
                binaryWriter.Write((float)m_pageSettings.PhysicalPageWidth);
                binaryWriter.Write((byte)20);
                binaryWriter.Write((float)m_pageSettings.MarginBottom);
                binaryWriter.Write((byte)19);
                binaryWriter.Write((float)m_pageSettings.MarginLeft);
                binaryWriter.Write((byte)21);
                binaryWriter.Write((float)m_pageSettings.MarginRight);
                binaryWriter.Write((byte)18);
                binaryWriter.Write((float)m_pageSettings.MarginTop);
                new ReportSectionPage(m_report.ReportSections[0].Page).WriteItemStyle(rplWriter, m_pageContext);
                binaryWriter.Write(byte.MaxValue);
            }
            else
            {
                RPLReport rPLReport = new RPLReport();
                rPLReport.ReportName        = m_report.Name;
                rPLReport.Description       = m_report.Description;
                rPLReport.Author            = m_report.Author;
                rPLReport.AutoRefresh       = m_report.AutoRefresh;
                rPLReport.ExecutionTime     = m_report.ExecutionTime;
                rPLReport.Location          = m_report.Location.ToString();
                rPLReport.Language          = reportLanguage;
                rPLReport.RPLVersion        = m_rplVersion;
                rPLReport.RPLPaginatedPages = new RPLPageContent[1];
                rplWriter.Report            = rPLReport;
            }
        }
Пример #19
0
 internal ALayout(RPLReport report)
 {
     m_report = report;
 }
Пример #20
0
 internal RPLWriter(BinaryWriter binaryWriter, RPLReport report, RPLTablixRow tablixRow)
 {
     BinaryWriter = binaryWriter;
     Report       = report;
     TablixRow    = tablixRow;
 }
Пример #21
0
        protected override void Render(AspNetCore.ReportingServices.OnDemandReportRendering.Report report, NameValueCollection deviceInfo, Hashtable renderProperties, CreateAndRegisterStream createAndRegisterStream)
        {
            PaginationSettings paginationSettings = new PaginationSettings(report, deviceInfo);

            paginationSettings.UseEmSquare       = true;
            paginationSettings.MeasureTextDpi    = 1000;
            paginationSettings.UseGenericDefault = false;
            if (paginationSettings.DynamicImageDpiX == 96)
            {
                paginationSettings.DynamicImageDpiX = 300;
            }
            if (paginationSettings.DynamicImageDpiY == 96)
            {
                paginationSettings.DynamicImageDpiY = 300;
            }
            BufferedStream bufferedStream = default(BufferedStream);

            using (HPBProcessing.HPBProcessing hPBProcessing = new HPBProcessing.HPBProcessing(report, paginationSettings, createAndRegisterStream, ref renderProperties))
            {
                hPBProcessing.SetContext(hPBProcessing.PaginationSettings.StartPage, hPBProcessing.PaginationSettings.EndPage);
                using (Renderer renderer = new Renderer(true))
                {
                    bufferedStream = new BufferedStream(createAndRegisterStream(report.Name, "pdf", null, "application/pdf", false, StreamOper.CreateAndRegister));
                    using (PDFWriter pDFWriter = new PDFWriter(renderer, bufferedStream, false, createAndRegisterStream, hPBProcessing.PaginationSettings.DpiX, hPBProcessing.PaginationSettings.DpiY))
                    {
                        pDFWriter.HumanReadablePDF = this.m_humanReadablePDF;
                        pDFWriter.PrintOnOpen      = this.m_printOnOpen;
                        pDFWriter.Test             = this.m_test;
                        pDFWriter.EmbedFonts       = this.m_embedFonts;
                        if (report.HasDocumentMap)
                        {
                            DocumentMap documentMap = null;
                            try
                            {
                                documentMap = report.DocumentMap;
                                if (documentMap != null)
                                {
                                    if (documentMap.MoveNext())
                                    {
                                        DocumentMapNode current = documentMap.Current;
                                        PDFRenderer.HandleDocumentMap(documentMap, pDFWriter.DocumentMapRootLabel = new PDFLabel(current.Id, current.Label), 1);
                                    }
                                    if (pDFWriter.DocumentMapRootLabel.Children == null || pDFWriter.DocumentMapRootLabel.Children.Count == 0)
                                    {
                                        pDFWriter.DocumentMapRootLabel = null;
                                    }
                                    else
                                    {
                                        pDFWriter.DocumentMapLabelPoints = new Dictionary <string, PDFPagePoint>();
                                    }
                                }
                            }
                            finally
                            {
                                if (documentMap != null)
                                {
                                    documentMap.Dispose();
                                }
                            }
                        }
                        int num = hPBProcessing.PaginationSettings.StartPage;
                        pDFWriter.BeginReport(hPBProcessing.PaginationSettings.MeasureTextDpi, hPBProcessing.PaginationSettings.MeasureTextDpi);
                        while (true)
                        {
                            RPLReport rPLReport = default(RPLReport);
                            hPBProcessing.GetNextPage(out rPLReport);
                            if (rPLReport == null)
                            {
                                break;
                            }
                            renderer.ProcessPage(rPLReport, num, hPBProcessing.SharedFontCache, hPBProcessing.GlyphCache);
                            rPLReport.Release();
                            rPLReport = null;
                            num++;
                        }
                        pDFWriter.EndReport();
                    }
                }
            }
            bufferedStream.Flush();
        }
Пример #22
0
        public static void ReadReportMeasurements(RPLReport report, ALayout layout, bool suppressOutlines, RPLReportSection firstReportSection)
        {
            int            num            = 0;
            int            left           = 0;
            int            num2           = 0;
            int            num3           = 0;
            int            left2          = 0;
            int            num4           = 0;
            int            num5           = 0;
            int            left3          = 0;
            int            num6           = 0;
            RPLPageContent rPLPageContent = report.RPLPaginatedPages[0];
            RPLPageLayout  pageLayout     = rPLPageContent.PageLayout;
            int            width          = LayoutConvert.ConvertMMTo20thPoints((double)rPLPageContent.MaxSectionWidth);

            for (RPLReportSection rPLReportSection = firstReportSection; rPLReportSection != null; rPLReportSection = rPLPageContent.GetNextReportSection())
            {
                layout.SetIsLastSection(!rPLPageContent.HasNextReportSection());
                RPLItemMeasurement rPLItemMeasurement = rPLReportSection.Columns[0];
                ALayout            pageHeaderLayout;
                if (rPLReportSection.Header != null)
                {
                    num             += LayoutConvert.ConvertMMTo20thPoints((double)rPLReportSection.Header.Top);
                    left             = LayoutConvert.ConvertMMTo20thPoints((double)rPLReportSection.Header.Left);
                    num2             = LayoutConvert.ConvertMMTo20thPoints((double)rPLReportSection.Header.Height);
                    pageHeaderLayout = layout.GetPageHeaderLayout(rPLReportSection.Header.Width, rPLReportSection.Header.Height);
                    if (num2 > 0)
                    {
                        if (pageLayout.Style != null)
                        {
                            pageHeaderLayout.AddReportItem(pageLayout, num, left, width, num2, 0, 0, null, null);
                        }
                        pageHeaderLayout.AddReportItem(rPLReportSection.Header.Element.RPLSource, num, left, width, num2, 0, 0, null, null);
                    }
                }
                else
                {
                    pageHeaderLayout = layout.GetPageHeaderLayout(0f, 0f);
                }
                if (rPLItemMeasurement != null)
                {
                    num3 += LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Top);
                    left2 = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Left);
                    num4  = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Height);
                    if (layout.HeaderInBody)
                    {
                        num3 += num2;
                    }
                    if (layout.FooterInBody)
                    {
                        num5 = num3 + num4;
                    }
                    if (pageLayout.Style != null)
                    {
                        layout.AddReportItem(pageLayout, num3, left2, width, num4, 0, rPLItemMeasurement.State, null, null);
                    }
                    layout.AddReportItem(rPLItemMeasurement.Element.RPLSource, num3, left2, width, num4, 0, rPLItemMeasurement.State, null, null);
                }
                ALayout pageFooterLayout;
                if (rPLReportSection.Footer != null)
                {
                    num5            += LayoutConvert.ConvertMMTo20thPoints((double)rPLReportSection.Footer.Top);
                    left3            = LayoutConvert.ConvertMMTo20thPoints((double)rPLReportSection.Footer.Left);
                    num6             = LayoutConvert.ConvertMMTo20thPoints((double)rPLReportSection.Footer.Height);
                    pageFooterLayout = layout.GetPageFooterLayout(rPLReportSection.Footer.Width, rPLReportSection.Footer.Height);
                    if (num6 > 0)
                    {
                        if (pageLayout.Style != null)
                        {
                            pageFooterLayout.AddReportItem(pageLayout, num5, left3, width, num6, 0, 0, null, null);
                        }
                        pageFooterLayout.AddReportItem(rPLReportSection.Footer.Element.RPLSource, num5, left3, width, num6, 0, 0, null, null);
                    }
                }
                else
                {
                    pageFooterLayout = layout.GetPageFooterLayout(0f, 0f);
                }
                Dictionary <string, ToggleParent> toggleParents = null;
                if (!suppressOutlines)
                {
                    toggleParents = new Dictionary <string, ToggleParent>();
                }
                if (rPLReportSection.Header != null)
                {
                    Reader.ReadMeasurement(rPLReportSection.Header.Element, pageHeaderLayout, num, left, 1, BlockOutlines.None, toggleParents, suppressOutlines, 0, null);
                }
                if (rPLItemMeasurement != null)
                {
                    Reader.ReadMeasurement(rPLItemMeasurement.Element, layout, num3, left2, 1, BlockOutlines.None, toggleParents, suppressOutlines, 0, null);
                }
                if (rPLReportSection.Footer != null)
                {
                    Reader.ReadMeasurement(rPLReportSection.Footer.Element, pageFooterLayout, num5, left3, 1, BlockOutlines.None, toggleParents, suppressOutlines, 0, null);
                }
                int num7 = num3 + num4;
                if (layout.FooterInBody)
                {
                    num7 += num6;
                }
                num3 = (num = (num5 = num7));
                num4 = 0;
                num6 = 0;
                num2 = 0;
                rPLReportSection.Columns[0] = null;
                rPLReportSection.Header     = null;
                rPLReportSection.Footer     = null;
                layout.CompleteSection();
            }
            layout.CompletePage();
        }
 internal void ReadImage(IExcelGenerator excel, RPLImageData image, string imageName, RPLReport report)
 {
     if (excel == null || image == null || report == null || imageName == null)
     {
         return;
     }
     SetMimeType(image.ImageMimeType);
     m_imageName = imageName;
     if (image.ImageData != null)
     {
         m_imageData = excel.CreateStream(imageName);
         m_imageData.Write(image.ImageData, 0, image.ImageData.Length);
     }
     else
     {
         if (image.ImageDataOffset <= 0)
         {
             m_imageData     = null;
             image.ImageData = null;
             return;
         }
         m_imageData = excel.CreateStream(imageName);
         report.GetImage(image.ImageDataOffset, m_imageData);
     }
     image.ImageData = null;
     if (image.GDIImageProps != null)
     {
         m_width                = image.GDIImageProps.Width;
         m_height               = image.GDIImageProps.Height;
         m_verticalResolution   = image.GDIImageProps.VerticalResolution;
         m_horizontalResolution = image.GDIImageProps.HorizontalResolution;
         m_imageFormat          = image.GDIImageProps.RawFormat;
     }
 }
Пример #24
0
 public ALayout(RPLReport report)
 {
     this.m_report = report;
 }
        public void ReadImage(IExcelGenerator excel, RPLImageData image, string imageName, RPLReport report)
        {
            if (excel != null && image != null && report != null && imageName != null)
            {
                this.SetMimeType(image.ImageMimeType);
                this.m_imageName = imageName;
                if (image.ImageData != null)
                {
                    this.m_imageData = excel.CreateStream(imageName);
                    this.m_imageData.Write(image.ImageData, 0, image.ImageData.Length);
                    goto IL_008d;
                }
                if (image.ImageDataOffset > 0)
                {
                    this.m_imageData = excel.CreateStream(imageName);
                    report.GetImage(image.ImageDataOffset, this.m_imageData);
                    goto IL_008d;
                }
                this.m_imageData = null;
                image.ImageData  = null;
            }
            return;

IL_008d:
            image.ImageData = null;
            if (image.GDIImageProps != null)
            {
                this.m_width                = image.GDIImageProps.Width;
                this.m_height               = image.GDIImageProps.Height;
                this.m_verticalResolution   = image.GDIImageProps.VerticalResolution;
                this.m_horizontalResolution = image.GDIImageProps.HorizontalResolution;
                this.m_imageFormat          = image.GDIImageProps.RawFormat;
            }
        }