Exemple #1
0
        /**
        * Updates the table row additions in the underlying table object
        */
        private void UpdateRowAdditionsInternal()
        {
            // correct table : fill empty cells/ parse table in table
            int prevRows = Rows;
            int rowNumber = 0;
            int groupNumber = 0;
            bool groupChange;
            int firstDataRow = table.LastHeaderRow + 1;
            Cell cell;
            PdfCell currentCell;
            ArrayList newCells = new ArrayList();
            int rows = table.Size + 1;
            float[] offsets = new float[rows];
            for (int i = 0; i < rows; i++) {
                offsets[i] = Bottom;
            }

            // loop over all the rows
            foreach (Row row in table) {
                groupChange = false;
                if (row.IsEmpty()) {
                    if (rowNumber < rows - 1 && offsets[rowNumber + 1] > offsets[rowNumber]) offsets[rowNumber + 1] = offsets[rowNumber];
                }
                else {
                    for (int i = 0; i < row.Columns; i++) {
                        cell = (Cell) row.GetCell(i);
                        if (cell != null) {
                            currentCell = new PdfCell(cell, rowNumber+prevRows, positions[i], positions[i + cell.Colspan], offsets[rowNumber], Cellspacing, Cellpadding);
                            if (rowNumber < firstDataRow) {
                                currentCell.SetHeader();
                                headercells.Add(currentCell);
                                if (!table.NotAddedYet)
                                    continue;
                            }
                            try {
                                if (offsets[rowNumber] - currentCell.Height - Cellpadding < offsets[rowNumber + currentCell.Rowspan]) {
                                    offsets[rowNumber + currentCell.Rowspan] = offsets[rowNumber] - currentCell.Height - Cellpadding;
                                }
                            }
                            catch (ArgumentOutOfRangeException) {
                                if (offsets[rowNumber] - currentCell.Height < offsets[rows - 1]) {
                                    offsets[rows - 1] = offsets[rowNumber] - currentCell.Height;
                                }
                            }
                            currentCell.GroupNumber = groupNumber;
                            groupChange |= cell.GroupChange;
                            newCells.Add(currentCell);
                        }
                    }
                }
                rowNumber++;
                if ( groupChange ) groupNumber++;
            }

            // loop over all the cells
            int n = newCells.Count;
            for (int i = 0; i < n; i++) {
                currentCell = (PdfCell) newCells[i];
                try {
                    currentCell.Bottom = offsets[currentCell.Rownumber-prevRows + currentCell.Rowspan];
                }
                catch (ArgumentOutOfRangeException) {
                    currentCell.Bottom = offsets[rows - 1];
                }
            }
            cells.AddRange(newCells);
            Bottom = offsets[rows - 1];
        }
Exemple #2
0
        /**
         * Updates the table row additions in the underlying table object
         */

        private void UpdateRowAdditionsInternal()
        {
            // correct table : fill empty cells/ parse table in table
            int       prevRows    = Rows;
            int       rowNumber   = 0;
            int       groupNumber = 0;
            bool      groupChange;
            int       firstDataRow = table.LastHeaderRow + 1;
            Cell      cell;
            PdfCell   currentCell;
            ArrayList newCells = new ArrayList();
            int       rows     = table.Size + 1;

            float[] offsets = new float[rows];
            for (int i = 0; i < rows; i++)
            {
                offsets[i] = Bottom;
            }

            // loop over all the rows
            foreach (Row row in table)
            {
                groupChange = false;
                if (row.IsEmpty())
                {
                    if (rowNumber < rows - 1 && offsets[rowNumber + 1] > offsets[rowNumber])
                    {
                        offsets[rowNumber + 1] = offsets[rowNumber];
                    }
                }
                else
                {
                    for (int i = 0; i < row.Columns; i++)
                    {
                        cell = (Cell)row.GetCell(i);
                        if (cell != null)
                        {
                            currentCell = new PdfCell(cell, rowNumber + prevRows, positions[i], positions[i + cell.Colspan], offsets[rowNumber], Cellspacing, Cellpadding);
                            if (rowNumber < firstDataRow)
                            {
                                currentCell.SetHeader();
                                headercells.Add(currentCell);
                                if (!table.NotAddedYet)
                                {
                                    continue;
                                }
                            }
                            try {
                                if (offsets[rowNumber] - currentCell.Height - Cellpadding < offsets[rowNumber + currentCell.Rowspan])
                                {
                                    offsets[rowNumber + currentCell.Rowspan] = offsets[rowNumber] - currentCell.Height - Cellpadding;
                                }
                            }
                            catch (ArgumentOutOfRangeException) {
                                if (offsets[rowNumber] - currentCell.Height < offsets[rows - 1])
                                {
                                    offsets[rows - 1] = offsets[rowNumber] - currentCell.Height;
                                }
                            }
                            currentCell.GroupNumber = groupNumber;
                            groupChange            |= cell.GroupChange;
                            newCells.Add(currentCell);
                        }
                    }
                }
                rowNumber++;
                if (groupChange)
                {
                    groupNumber++;
                }
            }

            // loop over all the cells
            int n = newCells.Count;

            for (int i = 0; i < n; i++)
            {
                currentCell = (PdfCell)newCells[i];
                try {
                    currentCell.Bottom = offsets[currentCell.Rownumber - prevRows + currentCell.Rowspan];
                }
                catch (ArgumentOutOfRangeException) {
                    currentCell.Bottom = offsets[rows - 1];
                }
            }
            cells.AddRange(newCells);
            Bottom = offsets[rows - 1];
        }
Exemple #3
0
 public int NumCellRendered(PdfCell cell)
 {
     object i = pageMap[cell];
     if (i == null) {
         i = 0;
     }
     return (int)i;
 }
Exemple #4
0
            public bool IsCellRenderedOnPage(PdfCell cell, int pageNumber)
            {
                Hashtable seti = (Hashtable) pageMap[pageNumber];

                if (seti != null) {
                    return seti.ContainsKey(cell);
                }

                return false;
            }
Exemple #5
0
 /**
 * Looks at the current rowspan.
 * @param c
 * @return the current rowspan
 */
 public int CurrentRowspan(PdfCell c)
 {
     object i = rowspanMap[c];
     if (i == null) {
         return c.Rowspan;
     } else {
         return (int)i;
     }
 }
Exemple #6
0
            /**
            * Consumes the rowspan
            * @param c
            * @return a rowspan.
            */
            public int ConsumeRowspan(PdfCell c)
            {
                if (c.Rowspan == 1) {
                    return 1;
                }

                object i = rowspanMap[c];
                if (i == null) {
                    i = c.Rowspan;
                }

                i = (int)i - 1;
                rowspanMap[c] = i;

                if ((int)i < 1) {
                    return 1;
                }
                return (int)i;
            }
Exemple #7
0
            public int CellRendered(PdfCell cell, int pageNumber)
            {
                object i = pageMap[cell];
                if (i == null) {
                    i = 1;
                } else {
                    i = (int)i + 1;
                }
                pageMap[cell] = i;

                Hashtable seti = (Hashtable)pageMap[pageNumber];

                if (seti == null) {
                    seti = new Hashtable();
                    pageMap[pageNumber] = seti;
                }

                seti[cell] = null;

                return (int)i;
            }