SetCellRight() protected method

protected SetCellRight ( int cellRight ) : void
cellRight int
return void
Example #1
0
        /**
         * Performs a second pass over all cells to handle cell row/column spanning.
         */
        protected internal void HandleCellSpanning()
        {
            RtfCell deletedCell = new RtfCell(true);

            for (int i = 0; i < this.cells.Count; i++)
            {
                RtfCell rtfCell = (RtfCell)this.cells[i];
                if (rtfCell.Colspan > 1)
                {
                    int cSpan = rtfCell.Colspan;
                    for (int j = i + 1; j < i + cSpan; j++)
                    {
                        if (j < this.cells.Count)
                        {
                            RtfCell rtfCellMerge = (RtfCell)this.cells[j];
                            rtfCell.SetCellRight(rtfCell.GetCellRight() + rtfCellMerge.GetCellWidth());
                            rtfCell.SetCellWidth(rtfCell.GetCellWidth() + rtfCellMerge.GetCellWidth());
                            this.cells[j] = deletedCell;
                        }
                    }
                }
                if (rtfCell.Rowspan > 1)
                {
                    ArrayList rows = this.parentTable.GetRows();
                    for (int j = 1; j < rtfCell.Rowspan; j++)
                    {
                        RtfRow mergeRow = (RtfRow)rows[this.rowNumber + j];
                        if (this.rowNumber + j < rows.Count)
                        {
                            RtfCell rtfCellMerge = (RtfCell)mergeRow.GetCells()[i];
                            rtfCellMerge.SetCellMergeChild(rtfCell);
                        }
                        if (rtfCell.Colspan > 1)
                        {
                            int cSpan = rtfCell.Colspan;
                            for (int k = i + 1; k < i + cSpan; k++)
                            {
                                if (k < mergeRow.GetCells().Count)
                                {
                                    mergeRow.GetCells()[k] = deletedCell;
                                }
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Imports a Row and copies all settings
        /// </summary>
        /// <param name="row">The Row to import</param>
        private void importRow(Row row)
        {
            _cells = new ArrayList();
            _width = Document.GetDocumentHeader().GetPageSetting().GetPageWidth() - Document.GetDocumentHeader().GetPageSetting().GetMarginLeft() - Document.GetDocumentHeader().GetPageSetting().GetMarginRight();
            _width = (int)(_width * _parentTable.GetTableWidthPercent() / 100);

            var cellRight = 0;
            var cellWidth = 0;

            for (var i = 0; i < row.Columns; i++)
            {
                cellWidth = (int)(_width * _parentTable.GetProportionalWidths()[i] / 100);
                cellRight = cellRight + cellWidth;

                var cell    = (Cell)row.GetCell(i);
                var rtfCell = new RtfCell(Document, this, cell);
                rtfCell.SetCellRight(cellRight);
                rtfCell.SetCellWidth(cellWidth);
                _cells.Add(rtfCell);
            }
        }
Example #3
0
        /**
         * Imports a Row and copies all settings
         *
         * @param row The Row to import
         */
        private void ImportRow(Row row)
        {
            this.cells = new ArrayList();
            this.width = this.document.GetDocumentHeader().GetPageSetting().GetPageWidth() - this.document.GetDocumentHeader().GetPageSetting().GetMarginLeft() - this.document.GetDocumentHeader().GetPageSetting().GetMarginRight();
            this.width = (int)(this.width * this.parentTable.GetTableWidthPercent() / 100);

            int cellRight = 0;
            int cellWidth = 0;

            for (int i = 0; i < row.Columns; i++)
            {
                cellWidth = (int)(this.width * this.parentTable.GetProportionalWidths()[i] / 100);
                cellRight = cellRight + cellWidth;

                Cell    cell    = (Cell)row.GetCell(i);
                RtfCell rtfCell = new RtfCell(this.document, this, cell);
                rtfCell.SetCellRight(cellRight);
                rtfCell.SetCellWidth(cellWidth);
                this.cells.Add(rtfCell);
            }
        }
Example #4
0
        /// <summary>
        /// Imports a PdfPRow and copies all settings
        /// @since 2.1.3
        /// </summary>
        /// <param name="row">The PdfPRow to import</param>
        private void importRow(PdfPRow row)
        {
            _cells = new ArrayList();
            _width = Document.GetDocumentHeader().GetPageSetting().GetPageWidth() - Document.GetDocumentHeader().GetPageSetting().GetMarginLeft() - Document.GetDocumentHeader().GetPageSetting().GetMarginRight();
            _width = (int)(_width * _parentTable.GetTableWidthPercent() / 100);

            int cellRight = 0;
            int cellWidth = 0;

            PdfPCell[] cells = row.GetCells();
            for (int i = 0; i < cells.Length; i++)
            {
                cellWidth = (int)(_width * _parentTable.GetProportionalWidths()[i] / 100);
                cellRight = cellRight + cellWidth;

                PdfPCell cell    = cells[i];
                RtfCell  rtfCell = new RtfCell(Document, this, cell);
                rtfCell.SetCellRight(cellRight);
                rtfCell.SetCellWidth(cellWidth);
                _cells.Add(rtfCell);
            }
        }