Example #1
0
        private int PageNByBookmark(string bookmark)
        {
            int pageN = -1;

            if (Report.PreparedPages != null)
            {
                for (int i = 0; i < Report.PreparedPages.Count; i++)
                {
                    ReportPage page = Report.PreparedPages.GetPage(i);
                    if (page != null)
                    {
                        ObjectCollection allObjects = page.AllObjects;
                        for (int j = 0; j < allObjects.Count; j++)
                        {
                            ReportComponentBase c = allObjects[j] as ReportComponentBase;
                            if (c.Bookmark == bookmark)
                            {
                                pageN = i;
                                break;
                            }
                        }
                        page.Dispose();
                        if (pageN != -1)
                        {
                            break;
                        }
                    }
                }
            }
            return(pageN);
        }
Example #2
0
 internal void EndGetPage(ReportPage page)
 {
     if (posprocessor != null)
     {
         posprocessor = null;
     }
     if (page != null)
     {
         page.Dispose();
     }
     ClearUploadedXml();
 }
Example #3
0
 internal void ExportPageNew(int pageNo)
 {
     PreparedPage ppage = Report.PreparedPages.GetPreparedPage(pageNo);
     {
         ReportPage page = null;
         try
         {
             page        = ppage.StartGetPage(pageNo);
             page.Width  = ppage.PageSize.Width;
             page.Height = ppage.PageSize.Height;
             ExportPageBegin(page);
             float topShift = 0;
             foreach (Base obj in ppage.GetPageItems(page, false))
             {
                 if (shiftNonExportable && topShift != 0 && obj is BandBase &&
                     !(obj is PageFooterBand) && !(obj as BandBase).PrintOnBottom)
                 {
                     (obj as BandBase).Top -= topShift;
                 }
                 if ((obj as BandBase).Exportable ||
                     webPreview)
                 {
                     ExportBand(obj);
                 }
                 else if (obj != null)
                 {
                     if (shiftNonExportable)
                     {
                         topShift += (obj as BandBase).Height;
                     }
                     obj.Dispose();
                 }
             }
             ExportPageEnd(page);
         }
         finally
         {
             ppage.EndGetPage(page);
         }
         if (page != null)
         {
             page.Dispose();
         }
     }
 }
Example #4
0
        /// <inheritdoc/>
        protected override void ExportPage(int pageNo)
        {
            ReportPage page   = GetPage(pageNo);
            float      zoomX  = ResolutionX / 96f;
            float      zoomY  = ResolutionY / 96f;
            int        width  = (int)(page.PaperWidth * Units.Millimeters * zoomX);
            int        height = (int)(page.PaperHeight * Units.Millimeters * zoomY);

            int    suffixDigits = Pages[Pages.Length - 1].ToString().Length;
            string fileSuffix   = FFirstPage ? "" : (pageNo + 1).ToString("".PadLeft(suffixDigits, '0'));

            System.Drawing.Image image = null;
            if (SeparateFiles || IsMultiFrameTiff)
            {
                image = CreateImage(width, height, fileSuffix);
                if (IsMultiFrameTiff && FMasterTiffImage == null)
                {
                    FMasterTiffImage = image;
                }
            }
            else
            {
                image = FBigImage;
            }

            using (Graphics g = Graphics.FromImage(image))
            {
                if (image == FBigImage)
                {
                    g.TranslateTransform(0, FCurOriginY);
                }
                g.ScaleTransform(1, zoomY / zoomX);
                page.Draw(new FRPaintEventArgs(g, zoomX, zoomX, Report.GraphicCache));
            }

            if (SeparateFiles || IsMultiFrameTiff)
            {
                SaveImage(image, fileSuffix);
            }

            page.Dispose();
            FCurOriginY += height;
            FFirstPage   = false;
        }
Example #5
0
        public static void FindClickedObject <T>(
            this Report Report,
            string objectName,
            int pageN,
            float left,
            float top,
            Action <T, ReportPage, int> action
            )
            where T : ComponentBase
        {
            if (Report.PreparedPages == null)
            {
                return;
            }

            bool found = false;

            while (pageN < Report.PreparedPages.Count && !found)
            {
                ReportPage page = Report.PreparedPages.GetPage(pageN);
                if (page != null)
                {
                    ObjectCollection allObjects = page.AllObjects;
                    var point = new System.Drawing.PointF(left + 1, top + 1);
                    foreach (Base obj in allObjects)
                    {
                        if (obj is T c &&
                            c.Name == objectName &&
                            c.AbsBounds.Contains(point))
                        {
                            action(c, page, pageN);
                            found = true;
                            break;
                        }
                    }
                    page.Dispose();
                    pageN++;
                }
            }
        }
Example #6
0
 public void Dispose()
 {
     page.Dispose();
     page = null;
 }
Example #7
0
 private void DoClickObjectByParamID(string objectName, int pageN, float left, float top)
 {
     if (Report.PreparedPages != null)
     {
         bool found = false;
         while (pageN < Report.PreparedPages.Count && !found)
         {
             ReportPage page = Report.PreparedPages.GetPage(pageN);
             if (page != null)
             {
                 ObjectCollection      allObjects = page.AllObjects;
                 System.Drawing.PointF point      = new System.Drawing.PointF(left + 1, top + 1);
                 foreach (Base obj in allObjects)
                 {
                     if (obj is ReportComponentBase)
                     {
                         ReportComponentBase c = obj as ReportComponentBase;
                         if (c is TableBase)
                         {
                             TableBase table = c as TableBase;
                             for (int i = 0; i < table.RowCount; i++)
                             {
                                 for (int j = 0; j < table.ColumnCount; j++)
                                 {
                                     TableCell textcell = table[j, i];
                                     if (textcell.Name == objectName)
                                     {
                                         System.Drawing.RectangleF rect =
                                             new System.Drawing.RectangleF(table.Columns[j].AbsLeft,
                                                                           table.Rows[i].AbsTop,
                                                                           textcell.Width,
                                                                           textcell.Height);
                                         if (rect.Contains(point))
                                         {
                                             Click(textcell, pageN, page);
                                             found = true;
                                             break;
                                         }
                                     }
                                 }
                                 if (found)
                                 {
                                     break;
                                 }
                             }
                         }
                         else
                         if (c.Name == objectName &&
                             //#if FRCORE
                             c.AbsBounds.Contains(point))
                         //#else
                         //                                  c.PointInObject(point))
                         //#endif
                         {
                             Click(c, pageN, page);
                             found = true;
                             break;
                         }
                     }
                 }
                 page.Dispose();
                 pageN++;
             }
         }
     }
 }
Example #8
0
        public static void FindClickedObject <T>(
            this Report Report,
            string objectName,
            int pageN,
            float left,
            float top,
            Action <T, ReportPage, int> action
            )
            where T : ComponentBase
        {
            if (Report.PreparedPages == null)
            {
                return;
            }

            bool found = false;

            while (pageN < Report.PreparedPages.Count && !found)
            {
                ReportPage page = Report.PreparedPages.GetPage(pageN);
                if (page != null)
                {
                    ObjectCollection allObjects = page.AllObjects;
                    var point = new System.Drawing.PointF(left + 1, top + 1);
                    foreach (Base obj in allObjects)
                    {
                        if (obj is ReportComponentBase)
                        {
                            ReportComponentBase c = obj as ReportComponentBase;
                            if (c is TableBase)
                            {
                                TableBase table = c as TableBase;
                                for (int i = 0; i < table.RowCount; i++)
                                {
                                    for (int j = 0; j < table.ColumnCount; j++)
                                    {
                                        TableCell textcell = table[j, i];
                                        if (textcell.Name == objectName)
                                        {
                                            RectangleF rect = new RectangleF(table.Columns[j].AbsLeft,
                                                                             table.Rows[i].AbsTop,
                                                                             textcell.Width,
                                                                             textcell.Height);
                                            if (rect.Contains(point))
                                            {
                                                action(textcell as T, page, pageN);
                                                found = true;
                                                break;
                                            }
                                        }
                                    }
                                    if (found)
                                    {
                                        break;
                                    }
                                }
                            }
                            else if (c is T)
                            {
                                if (c.Name == objectName && c.AbsBounds.Contains(point))
                                {
                                    action(c as T, page, pageN);
                                    found = true;
                                    break;
                                }
                            }
                            if (found)
                            {
                                break;
                            }
                        }
                    }
                    page.Dispose();
                    pageN++;
                }
            }
        }
Example #9
0
 public void Dispose()
 {
     Page.Dispose();
 }