Package org.apache.fop.render.rtf.rtflib.rtfdoc

Examples of org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell


            //while the current column is in row-spanning, act as if
            //a vertical merged cell would have been specified.
            while (tctx.getNumberOfColumns() > tctx.getColumnIndex()
                  && tctx.getColumnRowSpanningNumber().intValue() > 0) {
                RtfTableCell vCell = row.newTableCellMergedVertically(
                        (int)tctx.getColumnWidth(),
                        tctx.getColumnRowSpanningAttrs());
               
                if (!tctx.getFirstSpanningCol()) {
                    vCell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
                }
               
                tctx.selectNextColumn();
            }
        } catch (Exception e) {
View Full Code Here


            //while the current column is in row-spanning, act as if
            //a vertical merged cell would have been specified.
            while (tctx.getNumberOfColumns() > tctx.getColumnIndex()
                  && tctx.getColumnRowSpanningNumber().intValue() > 0) {
                RtfTableCell vCell = row.newTableCellMergedVertically(
                        (int)tctx.getColumnWidth(),
                        tctx.getColumnRowSpanningAttrs());
               
                if (!tctx.getFirstSpanningCol()) {
                    vCell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
                }
               
                tctx.selectNextColumn();
            }

            //get the width of the currently started cell
            float width = tctx.getColumnWidth();

            // create an RtfTableCell in the current RtfTableRow
            RtfAttributes atts = TableAttributesConverter.convertCellAttributes(tc);
            RtfTableCell cell = row.newTableCell((int)width, atts);
           
            //process number-rows-spanned attribute
            if (numberRowsSpanned > 1) {
                // Start vertical merge
                cell.setVMerge(RtfTableCell.MERGE_START);

                // set the number of rows spanned
                tctx.setCurrentColumnRowSpanning(new Integer(numberRowsSpanned),
                        cell.getRtfAttributes());
            } else {
                tctx.setCurrentColumnRowSpanning(
                        new Integer(numberRowsSpanned), null);
            }

            //process number-columns-spanned attribute
            if (numberColumnsSpanned > 0) {
                // Get the number of columns spanned
                RtfTable table = row.getTable();
                tctx.setCurrentFirstSpanningCol(true);
               
                // We widthdraw one cell because the first cell is already created
                // (it's the current cell) !
                 for (int i = 0; i < numberColumnsSpanned - 1; ++i) {
                    tctx.selectNextColumn();
                   
                    tctx.setCurrentFirstSpanningCol(false);
                    RtfTableCell hCell = row.newTableCellMergedHorizontally(
                            0, null);
                   
                    if (numberRowsSpanned > 1) {
                        // Start vertical merge
                        hCell.setVMerge(RtfTableCell.MERGE_START);

                        // set the number of rows spanned
                        tctx.setCurrentColumnRowSpanning(
                                new Integer(numberRowsSpanned),
                                cell.getRtfAttributes());
View Full Code Here

            //while the current column is in row-spanning, act as if
            //a vertical merged cell would have been specified.
            while (tctx.getNumberOfColumns() > tctx.getColumnIndex()
                  && tctx.getColumnRowSpanningNumber().intValue() > 0) {
                RtfTableCell vCell = row.newTableCellMergedVertically(
                        (int)tctx.getColumnWidth(),
                        tctx.getColumnRowSpanningAttrs());

                if (!tctx.getFirstSpanningCol()) {
                    vCell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
                }

                tctx.selectNextColumn();
            }
        } catch (Exception e) {
View Full Code Here

            //while the current column is in row-spanning, act as if
            //a vertical merged cell would have been specified.
            while (tctx.getNumberOfColumns() > tctx.getColumnIndex()
                  && tctx.getColumnRowSpanningNumber().intValue() > 0) {
                RtfTableCell vCell = row.newTableCellMergedVertically(
                        (int)tctx.getColumnWidth(),
                        tctx.getColumnRowSpanningAttrs());

                if (!tctx.getFirstSpanningCol()) {
                    vCell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
                }

                tctx.selectNextColumn();
            }

            //get the width of the currently started cell
            float width = tctx.getColumnWidth();

            // create an RtfTableCell in the current RtfTableRow
            RtfAttributes atts = TableAttributesConverter.convertCellAttributes(tc);
            RtfTableCell cell = row.newTableCell((int)width, atts);

            //process number-rows-spanned attribute
            if (numberRowsSpanned > 1) {
                // Start vertical merge
                cell.setVMerge(RtfTableCell.MERGE_START);

                // set the number of rows spanned
                tctx.setCurrentColumnRowSpanning(new Integer(numberRowsSpanned),
                        cell.getRtfAttributes());
            } else {
                tctx.setCurrentColumnRowSpanning(
                        new Integer(numberRowsSpanned), null);
            }

            //process number-columns-spanned attribute
            if (numberColumnsSpanned > 0) {
                // Get the number of columns spanned
                tctx.setCurrentFirstSpanningCol(true);

                // We widthdraw one cell because the first cell is already created
                // (it's the current cell) !
                 for (int i = 0; i < numberColumnsSpanned - 1; ++i) {
                    tctx.selectNextColumn();

                    //aggregate width for further elements
                    width += tctx.getColumnWidth();
                    tctx.setCurrentFirstSpanningCol(false);
                    RtfTableCell hCell = row.newTableCellMergedHorizontally(
                            0, null);

                    if (numberRowsSpanned > 1) {
                        // Start vertical merge
                        hCell.setVMerge(RtfTableCell.MERGE_START);

                        // set the number of rows spanned
                        tctx.setCurrentColumnRowSpanning(
                                new Integer(numberRowsSpanned),
                                cell.getRtfAttributes());
View Full Code Here

        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());

        // first row, test horizontal merging
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.setHMerge(RtfTableCell.MERGE_START);
            c.newParagraph().newText("cell 0,0, width 80mm, merge start, "
                    + "followed by two merged cells totalling 80mm width.");

            c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
            c.newParagraph().newText("THIS IS IN AN HMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");

            c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
            c.newParagraph().newText("THIS IS IN AN HMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
        }

        // second row, start vertical merging in column 1
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setVMerge(RtfTableCell.MERGE_START);
            c.newParagraph().newText("cell 1,0, vertical merge start, 40mm, spans three rows.");

            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText("cell 1,1, no merge, 80mm");

            c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setVMerge(RtfTableCell.MERGE_START);
            c.newParagraph().newText("cell 1,2, vertical merge start, 40mm, spans two rows.");
        }

        // third row, column 1 merged with previous row
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
            c.newParagraph().newText("cell 2,0, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 2,1, no merge, 40mm");
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 2,2, no merge, 40mm");

            c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
            c.newParagraph().newText("cell 2,3, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");
        }

        // fourth row, column 1 merged with previous row
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(40 * MM_TO_TWIPS);
            c.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
            c.newParagraph().newText("cell 3,0, VMERGED CELL, MUST NOT APPEAR IN RTF DOCUMENT");

            r.newTableCell(10 * MM_TO_TWIPS).newParagraph().newText("cell 3,1, no merge, 10mm");
            r.newTableCell(30 * MM_TO_TWIPS).newParagraph().newText("cell 3,2, no merge, 30mm");
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 3,3, no merge, 40mm");
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText("cell 3,4, no merge, 40mm");
View Full Code Here

        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        final RtfTableRow row = tbl.newTableRow();
        row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell A, simple");

        final RtfTableCell c = row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH);
        c.newParagraph().newText("cell B, contains this paragraph followed by "
                + "a list and another paragraph");
        fillList(c.newList(null), 1, 3);
        c.newParagraph().newText("Normal paragraph, follows the list.");

        row.newTableCell(RtfTableCell.DEFAULT_CELL_WIDTH).newParagraph().newText("cell C, simple");
    }
View Full Code Here

        sect.newParagraph().newText("First test: table with one nested table in cell 1,1");
        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        // first row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 0,0, width 160mm, only cell in this row.");
        }

        // second row contains nested table
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,0, width 40mm, to the left of nested table.");

            final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 1,1, width 80mm, this text is "
                    + "followed by a nested table in the same cell, followed "
                    + "by text that says 'AFTER NESTED TABLE'.");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 1);
            c.newParagraph().newText("AFTER NESTED TABLE");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,2, width 40mm, to the right of nested table.");
        }

View Full Code Here

        sect.newParagraph().newText("Second test: table with two nested tables in cell 1,1");
        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        // first row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS);
            c.newParagraph().newText("second test table: cell 0,0, width 160mm, "
                    + "only cell in this row.");
        }

        // second row contains nested table
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,0, width 40mm, to the left of nested tables.");

            final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 1,1, width 80mm, this text is "
                    + "followed by a nested table in the same cell, followed "
                    + "by text that says 'BETWEEN', then another table, then 'AFTER'.");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 2);
            c.newParagraph().newText("BETWEEN");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 3);
            c.newParagraph().newText("AFTER");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,2, width 40mm, to the right of nested table.");
        }

View Full Code Here

                + "in cell 1,1 and one nested table in cell 0,1");
        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        // first row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("third test table: cell 0,0, width 40mm, "
                    + "the cell to its right contains a nested table with no other text.");
            c = r.newTableCell(80 * MM_TO_TWIPS);
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 4);
        }

        // second row contains nested table
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,0, width 40mm, to the left of nested tables.");

            final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 1,1, width 80mm, this text is "
                    + "followed by a nested table in the same cell, followed "
                    + "by text that says 'BETWEEN', then another table, then 'AFTER'.");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 5);
            c.newParagraph().newText("BETWEEN");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 6);
            c.newParagraph().newText("AFTER");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,2, width 40mm, to the right of nested table.");
        }

View Full Code Here

            final RtfTableRow r = tbl.newTableRow();

            for (int col = 0; col < MAX_COL; col++) {
                final float widthInInches = col / 2f + 1f;
                final int widthInTwips = (int)(widthInInches * INCH_TO_TWIPS);
                final RtfTableCell c = r.newTableCell(widthInTwips);
                c.newParagraph().newText("(" + row + "," + col + "), width "
                        + widthInInches  + "''");
                if (row == 0 && col == 1) {
                    for (int i = 0; i < 4; i++) {
                        c.newParagraph().newText("additional paragraph " + i + " of cell 0,1");
                    }
                }
            }
        }

View Full Code Here

TOP

Related Classes of org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.