Example #1
0
 /// <summary>
 /// adds a Pdf Element into this PdfPage.
 /// </summary>
 /// <param name="PdfTablePage"></param>
 public void Add(PdfTablePage PdfTablePage)
 {
     if (PdfTablePage != null)
     {
         PdfTablePage.ID = this.PdfDocument.GetNextId;
         this.PagePdfObjects.Add(PdfTablePage);
     }
 }
Example #2
0
        internal PdfTablePage createTablePage()
        {
            int    index = this.renderingIndex;
            double h     = this.Rows[index].Height;


            double oh = 0;

            while ((h <= this.TableArea.height) && (index < this.rows))
            {
                index++;
                oh = h;
                if (index < this.rows)
                {
                    double rowHeight = this.Rows[index].Height;
                    h += rowHeight;
                }
            }
            this.renderingRows    = index - this.renderingIndex;
            this.TableArea.height = oh;


            PdfTablePage ptp = new PdfTablePage(renderingIndex, renderingIndex + renderingRows - 1, columns);


            //caculates areas
            double y = this.TableArea.posy;

            for (int rowIndex = this.renderingIndex; (rowIndex < this.renderingIndex + this.renderingRows); rowIndex++)
            {
                double x         = this.TableArea.posx;
                double rowHeight = this.Rows[rowIndex].Height;
                for (int columnIndex = 0; columnIndex < this.columns; columnIndex++)
                {
                    PdfCell pc    = this.Cell(rowIndex, columnIndex);
                    double  width = pc.Width;

                    pc.area = new PdfArea(this.PdfDocument, x, y, width, rowHeight);
                    x      += width;
                }

                y += rowHeight;
            }

            for (int rowIndex = this.renderingIndex; (rowIndex < this.renderingIndex + this.renderingRows); rowIndex++)
            {
                for (int columnIndex = 0; columnIndex < this.columns; columnIndex++)
                {
                    PdfCell pc = this.Cell(rowIndex, columnIndex);

                    ptp.cellAreas.Add(pc.row + "," + pc.column, pc.Area);
                }
            }


            ptp.byteStream = this.ToByteStream();
            ptp.SetArea();

            this.renderingIndex = index;
            this.renderingRows  = 0;
            return(ptp);
        }