Esempio n. 1
0
 /**
  * Pregenerate the <code>RtfCell</code>s in this <code>RtfRow</code>.
  *
  * @param columns The number of <code>RtfCell</code>s to be generated.
  */
 public void PregenerateRows(int columns)
 {
     for (int i = 0; i < columns; i++)
     {
         RtfCell rtfCell = new RtfCell(writer, mainTable);
         cells.Add(rtfCell);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Sets the merge type and the RtfCell with which this
 /// RtfCell is to be merged.
 /// </summary>
 /// <param name="mergeType">
 /// The merge type specifies the kind of merge to be applied
 /// (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)
 /// </param>
 /// <param name="mergeCell">
 /// The RtfCell that the cell at x and y is to
 /// be merged with
 /// </param>
 public void setMerge(int mergeType, RtfCell mergeCell)
 {
     this.mergeType = mergeType;
     store          = mergeCell.Store;
     // XXX i think that this is false here, because the width must be set in importCell
     // in an colspan, not all cells have the same width
     //        cellWidth = mergeCell.getCellWidth();
 }
Esempio n. 3
0
        /// <summary>
        /// RtfCells call this method to specify that a certain other cell is to be merged with it.
        /// </summary>
        /// <param name="x">The column position of the cell to be merged</param>
        /// <param name="y">The row position of the cell to be merged</param>
        /// <param name="mergeType">The merge type specifies the kind of merge to be applied (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)</param>
        /// <param name="mergeCell">The RtfCell that the cell at x and y is to be merged with</param>
        public void setMerge(int x, int y, int mergeType, RtfCell mergeCell)
        {
            RtfRow row = (RtfRow)rowsList[y];

            row.setMerge(x, mergeType, mergeCell);
        }
Esempio n. 4
0
        /**
         * <code>RtfTable</code>s call this method from their own SetMerge() to
         * specify that a certain other cell is to be merged with it.
         *
         * @param x The column position of the cell to be merged
         * @param mergeType The merge type specifies the kind of merge to be applied
         * (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)
         * @param mergeCell The <code>RtfCell</code> that the cell at x and y is to
         * be merged with
         */
        public void SetMerge(int x, int mergeType, RtfCell mergeCell)
        {
            RtfCell cell = (RtfCell)cells[x];

            cell.SetMerge(mergeType, mergeCell);
        }
Esempio n. 5
0
        /**
         * Import a <code>Row</code>.
         * <P>
         * All the parameters are taken from the <code>RtfTable</code> which contains
         * this <code>RtfRow</code> and they do exactely what they say
         * @param row
         * @param propWidths in percent
         * @param tableWidth in percent
         * @param pageWidth
         * @param cellpadding
         * @param cellspacing
         * @param borders
         * @param borderColor
         * @param borderWidth
         * @param y
         * @return true if importing the row succeeded
         */
        public bool ImportRow(Row row, float[] propWidths, int tableWidth, int pageWidth, int cellpadding,
                              int cellspacing, int borders, Color borderColor, float borderWidth,
                              int y)
        {
            // the width of this row is the absolute witdh, calculated from the
            // proportional with of the table and the total width of the page
            this.origRow     = row;
            this.width       = pageWidth / 100 * tableWidth;
            this.cellpadding = cellpadding;
            this.cellspacing = cellspacing;
            this.borders     = borders;
            this.borderColor = borderColor;
            this.borderWidth = borderWidth;

            if (this.borderWidth > 2)
            {
                this.borderWidth = 2;
            }

            int cellLeft = 0;

            for (int i = 0; i < row.Columns; i++)
            {
                IElement cell = (IElement)row.GetCell(i);

                // cellWidth is an absolute argument
                // it's based on the absolute of this row and the proportional
                // width of this column
                int cellWidth = (int)(width / 100 * propWidths[i]);
                if (cell != null)
                {
                    if (cell.Type == Element.CELL)
                    {
                        RtfCell rtfCell = (RtfCell)cells[i];
                        cellLeft = rtfCell.ImportCell((Cell)cell, cellLeft, cellWidth, i, y, cellpadding);
                    }
                }
                else
                {
                    RtfCell rtfCell = (RtfCell)cells[i];
                    cellLeft = rtfCell.ImportCell(null, cellLeft, cellWidth, i, y, cellpadding);
                }
            }

            // recalculate the cell right border and the cumulative width
            // on col spanning cells.
            // col + row spanning cells are also handled by this loop, because the real cell of
            // the upper left corner in such an col, row matrix is copied as first cell
            // in each row in this matrix
            int columns = row.Columns;

            for (int i = 0; i < columns; i++)
            {
                RtfCell firstCell = (RtfCell)cells[i];
                Cell    cell      = firstCell.GetStore();
                int     cols      = 0;
                if (cell != null)
                {
                    cols = cell.Colspan;
                }
                if (cols > 1)
                {
                    RtfCell lastCell = (RtfCell)cells[i + cols - 1];
                    firstCell.SetCellRight(lastCell.GetCellRight());
                    int width = firstCell.GetCellWidth();
                    for (int j = i + 1; j < i + cols; j++)
                    {
                        RtfCell cCell = (RtfCell)cells[j];
                        width += cCell.GetCellWidth();
                    }
                    firstCell.SetCellWidth(width);
                    i += cols - 1;
                }
            }
            return(true);
        }
Esempio n. 6
0
 /**
 * Sets the merge type and the <code>RtfCell</code> with which this
 * <code>RtfCell</code> is to be merged.
 *
 * @param mergeType The merge type specifies the kind of merge to be applied
 * (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)
 * @param mergeCell The <code>RtfCell</code> that the cell at x and y is to
 * be merged with
 */
 public void SetMerge(int mergeType, RtfCell mergeCell)
 {
     this.mergeType = mergeType;
     store = mergeCell.GetStore();
 }
Esempio n. 7
0
        /// <summary>
        /// Import a Row.
        /// </summary>
        /// <remarks>
        /// All the parameters are taken from the RtfTable which contains
        /// this RtfRow and they do exactely what they say
        /// </remarks>
        /// <param name="row"></param>
        /// <param name="propWidths">in percent</param>
        /// <param name="tableWidth">in percent</param>
        /// <param name="pageWidth"></param>
        /// <param name="cellpadding"></param>
        /// <param name="cellspacing"></param>
        /// <param name="borders"></param>
        /// <param name="borderColor"></param>
        /// <param name="borderWidth"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public bool importRow(Row row, float[] propWidths, int tableWidth, int pageWidth, int cellpadding,
                              int cellspacing, int borders, Color borderColor, float borderWidth,
                              int y)
        {
            // the width of this row is the absolute witdh, calculated from the
            // proportional with of the table and the total width of the page
            this.width       = pageWidth / 100 * tableWidth;
            this.cellpadding = cellpadding;
            this.cellspacing = cellspacing;
            this.borders     = borders;
            this.borderColor = borderColor;
            this.borderWidth = borderWidth;

            if (this.borderWidth > 2)
            {
                this.borderWidth = 2;
            }

            int cellLeft = 0;

            //        int cellWidth = (int) (((((float) pageWidth) / 100) * width) / row.Columns);
            for (int i = 0; i < row.Columns; i++)
            {
                IElement cell = (IElement)row.getCell(i);

                // cellWidth is an absolute argument
                // it's based on the absolute of this row and the proportional
                // width of this column
                int cellWidth = (int)(width / 100 * propWidths[i]);
                //            System.err.println( this.getClass().getName() + " cellWidth: " + cellWidth + " i: " + i);
                if (cell != null)
                {
                    if (cell.Type == Element.CELL)
                    {
                        RtfCell rtfCell = (RtfCell)cells[i];
                        cellLeft = rtfCell.importCell((Cell)cell, cellLeft, cellWidth, i, y, cellpadding);
                    }
                }
                else
                {
                    RtfCell rtfCell = (RtfCell)cells[i];
                    cellLeft = rtfCell.importCell(null, cellLeft, cellWidth, i, y, cellpadding);
                }
            }

            //<!-- steffen
            // recalculate the cell right border and the cumulative width
            // on col spanning cells.
            // col + row spanning cells are also handled by this loop, because the real cell of
            // the upper left corner in such an col, row matrix is copied as first cell
            // in each row in this matrix
            int columns = row.Columns;

            for (int i = 0; i < columns; i++)
            {
                RtfCell firstCell = (RtfCell)cells[i];
                Cell    cell      = firstCell.Store;
                //            if (elem != null && elem.type() == Element.CELL) {
                int cols = cell.Colspan;
                if (cols > 1)
                {
                    //                    RtfCell firstCell = (RtfCell)cells.get( i);
                    RtfCell lastCell = (RtfCell)cells[i + cols - 1];
                    firstCell.CellRight = lastCell.CellRight;
                    // sum the width of all following spanned cells
                    int width = firstCell.CellWidth;
                    for (int j = i + 1; j < i + cols; j++)
                    {
                        RtfCell cCell = (RtfCell)cells[j];
                        width += cCell.CellWidth;
                    }
                    firstCell.CellWidth = width;
                    i += cols - 1;
                }

                //            }
            }
            //-->
            return(true);
        }
Esempio n. 8
0
 /**
 * <code>RtfCell</code>s call this method to specify that a certain other cell is to be merged with it.
 *
 * @param x The column position of the cell to be merged
 * @param y The row position of the cell to be merged
 * @param mergeType The merge type specifies the kind of merge to be applied (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)
 * @param mergeCell The <code>RtfCell</code> that the cell at x and y is to be merged with
 */
 public void SetMerge(int x, int y, int mergeType, RtfCell mergeCell)
 {
     RtfRow row = (RtfRow) rowsList[y];
     row.SetMerge(x, mergeType, mergeCell);
 }
Esempio n. 9
0
 /**
 * <code>RtfTable</code>s call this method from their own SetMerge() to
 * specify that a certain other cell is to be merged with it.
 *
 * @param x The column position of the cell to be merged
 * @param mergeType The merge type specifies the kind of merge to be applied
 * (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)
 * @param mergeCell The <code>RtfCell</code> that the cell at x and y is to
 * be merged with
 */
 public void SetMerge(int x, int mergeType, RtfCell mergeCell)
 {
     RtfCell cell = (RtfCell) cells[x];
     cell.SetMerge(mergeType, mergeCell);
 }
Esempio n. 10
0
 /**
 * Pregenerate the <code>RtfCell</code>s in this <code>RtfRow</code>.
 *
 * @param columns The number of <code>RtfCell</code>s to be generated.
 */
 public void PregenerateRows(int columns)
 {
     for (int i = 0; i < columns; i++) {
         RtfCell rtfCell = new RtfCell(writer, mainTable);
         cells.Add(rtfCell);
     }
 }
Esempio n. 11
0
 /**
  * Sets the merge type and the <code>RtfCell</code> with which this
  * <code>RtfCell</code> is to be merged.
  *
  * @param mergeType The merge type specifies the kind of merge to be applied
  * (MERGE_HORIZ_PREV, MERGE_VERT_PREV, MERGE_BOTH_PREV)
  * @param mergeCell The <code>RtfCell</code> that the cell at x and y is to
  * be merged with
  */
 public void SetMerge(int mergeType, RtfCell mergeCell)
 {
     this.mergeType = mergeType;
     store          = mergeCell.GetStore();
 }