Example usage for com.lowagie.text Element ALIGN_UNDEFINED

List of usage examples for com.lowagie.text Element ALIGN_UNDEFINED

Introduction

In this page you can find the example usage for com.lowagie.text Element ALIGN_UNDEFINED.

Prototype

int ALIGN_UNDEFINED

To view the source code for com.lowagie.text Element ALIGN_UNDEFINED.

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:org.apache.poi.xwpf.converter.internal.itext.stylable.StylableTableCell.java

License:Open Source License

public void applyStyles(Object ele, Style style) {
    this.lastStyleApplied = style;

    StyleTableRowProperties tableRowProperties = style.getTableRowProperties();
    if (tableRowProperties != null) {
        Float rowHeight = tableRowProperties.getRowHeight();
        if (rowHeight != null) {
            super.setFixedHeight(rowHeight);
        }//from  w w  w.ja  v  a  2  s .c  o  m
    }
    StyleTableCellProperties tableCellProperties = style.getTableCellProperties();
    if (tableCellProperties != null) {

        // background-color
        Color backgroundColor = tableCellProperties.getBackgroundColor();
        if (backgroundColor != null) {
            super.setBackgroundColor(backgroundColor);
        }

        // border
        StyleBorder border = tableCellProperties.getBorder();
        StyleUtils.applyStyles(border, this);

        // border-top
        StyleBorder borderTop = tableCellProperties.getBorderTop();
        StyleUtils.applyStyles(borderTop, this);

        // border-bottom
        StyleBorder borderBottom = tableCellProperties.getBorderBottom();
        StyleUtils.applyStyles(borderBottom, this);

        // border-left
        StyleBorder borderLeft = tableCellProperties.getBorderLeft();
        StyleUtils.applyStyles(borderLeft, this);

        // border-right
        StyleBorder borderRight = tableCellProperties.getBorderRight();
        StyleUtils.applyStyles(borderRight, this);

        // padding
        StylePadding padding = tableCellProperties.getPadding();
        if (padding != null) {

            // padding
            if (padding.getPadding() != null) {
                super.setPadding(padding.getPadding());
            }

            // padding-top
            if (padding.getPaddingTop() != null) {
                super.setPaddingTop(padding.getPaddingTop());
            }

            // padding-bottom
            if (padding.getPaddingBottom() != null) {
                super.setPaddingBottom(padding.getPaddingBottom());
            }

            // padding-right
            if (padding.getPaddingRight() != null) {
                super.setPaddingRight(padding.getPaddingRight());
            }

            // padding-left
            if (padding.getPaddingLeft() != null) {
                super.setPaddingLeft(padding.getPaddingLeft());
            }
        }

        // Alignment
        int verticalAlignment = tableCellProperties.getVerticalAlignment();
        if (verticalAlignment != Element.ALIGN_UNDEFINED) {
            super.setVerticalAlignment(verticalAlignment);
        }

    }
}

From source file:org.apache.poi.xwpf.converter.internal.itext.styles.StyleParagraphProperties.java

License:Open Source License

public void merge(StyleParagraphProperties paragraphProperties) {
    if (paragraphProperties.getAlignment() != Element.ALIGN_UNDEFINED) {
        alignment = paragraphProperties.getAlignment();
    }/*  w ww.j a va 2  s  .  c  om*/
    if (paragraphProperties.getLineHeight() != null) {
        lineHeight = paragraphProperties.getLineHeight();
    }
}

From source file:org.apache.poi.xwpf.converter.internal.itext.styles.StyleTableCellProperties.java

License:Open Source License

public void merge(StyleTableCellProperties tableCellProperties) {
    if (tableCellProperties.getBackgroundColor() != null) {
        backgroundColor = tableCellProperties.getBackgroundColor();
    }/*w  ww.  j av a  2 s.  c o m*/
    if (tableCellProperties.getVerticalAlignment() != Element.ALIGN_UNDEFINED) {
        verticalAlignment = tableCellProperties.getVerticalAlignment();
    }
}

From source file:org.odftoolkit.odfdom.converter.internal.itext.stylable.StylableParagraph.java

License:Open Source License

public void applyStyles(Style style) {
    this.lastStyleApplied = style;

    StyleTextProperties textProperties = style.getTextProperties();
    if (textProperties != null) {
        // Font/*ww w  . jav a 2  s .  c  o  m*/
        Font font = textProperties.getFont();
        if (font != null) {
            super.setFont(font);
        }
    }

    StyleParagraphProperties paragraphProperties = style.getParagraphProperties();
    if (paragraphProperties != null) {
        // break-before
        StyleBreak breakBefore = paragraphProperties.getBreakBefore();
        if (breakBefore != null) {
            handleBreak(breakBefore);
        }

        // alignment
        int alignment = paragraphProperties.getAlignment();
        if (alignment != Element.ALIGN_UNDEFINED) {
            super.setAlignment(alignment);
        }

        // paragraph indentation
        Float margin = paragraphProperties.getMargin();
        if (margin != null) {
            super.setIndentationLeft(margin);
            super.setIndentationRight(margin);
            super.setSpacingBefore(margin);
            super.setSpacingAfter(margin);
        }
        Float marginLeft = paragraphProperties.getMarginLeft();
        if (marginLeft != null) {
            super.setIndentationLeft(marginLeft);
        }
        Float marginRight = paragraphProperties.getMarginRight();
        if (marginRight != null) {
            super.setIndentationRight(marginRight);
        }
        Float marginTop = paragraphProperties.getMarginTop();
        if (marginTop != null) {
            super.setSpacingBefore(marginTop);
        }
        Float marginBottom = paragraphProperties.getMarginBottom();
        if (marginBottom != null) {
            super.setSpacingAfter(marginBottom);
        }

        // first line indentation
        Boolean autoTextIndent = paragraphProperties.getAutoTextIndent();
        if (Boolean.TRUE.equals(autoTextIndent)) {
            float fontSize = font != null ? font.getCalculatedSize() : Font.DEFAULTSIZE;
            super.setFirstLineIndent(1.3f * fontSize);
        } else {
            Float textIndent = paragraphProperties.getTextIndent();
            if (textIndent != null) {
                super.setFirstLineIndent(textIndent);
            }
        }

        // line height
        StyleLineHeight lineHeight = paragraphProperties.getLineHeight();
        if (lineHeight != null && lineHeight.getLineHeight() != null) {
            if (lineHeight.isLineHeightProportional()) {
                super.setMultipliedLeading(lineHeight.getLineHeight());
            } else {
                super.setLeading(lineHeight.getLineHeight());
            }
        }

        // keep together on the same page
        Boolean keepTogether = paragraphProperties.getKeepTogether();
        if (keepTogether != null) {
            super.setKeepTogether(keepTogether);
        }

        // background color
        Color backgroundColor = paragraphProperties.getBackgroundColor();
        if (backgroundColor != null) {
            getWrapperCell().setBackgroundColor(backgroundColor);
        }

        // border
        StyleBorder border = paragraphProperties.getBorder();
        if (border != null) {
            StyleUtils.applyStyles(border, getWrapperCell());
        }

        // border-left
        StyleBorder borderLeft = paragraphProperties.getBorderLeft();
        if (borderLeft != null) {
            StyleUtils.applyStyles(borderLeft, getWrapperCell());
        }

        // border-right
        StyleBorder borderRight = paragraphProperties.getBorderRight();
        if (borderRight != null) {
            StyleUtils.applyStyles(borderRight, getWrapperCell());
        }

        // border-top
        StyleBorder borderTop = paragraphProperties.getBorderTop();
        if (borderTop != null) {
            StyleUtils.applyStyles(borderTop, getWrapperCell());
        }

        // border-bottom
        StyleBorder borderBottom = paragraphProperties.getBorderBottom();
        if (borderBottom != null) {
            StyleUtils.applyStyles(borderBottom, getWrapperCell());
        }
    }
}

From source file:org.odftoolkit.odfdom.converter.internal.itext.StyleEngineForIText.java

License:Open Source License

@Override
public void visit(StyleParagraphPropertiesElement ele) {

    StyleParagraphProperties paragraphProperties = currentStyle.getParagraphProperties();
    if (paragraphProperties == null) {
        paragraphProperties = new StyleParagraphProperties();
        currentStyle.setParagraphProperties(paragraphProperties);
    }//from   w w w .j a  v  a2 s. co  m

    // background-color
    String backgroundColor = ele.getFoBackgroundColorAttribute();
    if (StringUtils.isNotEmpty(backgroundColor)) {
        paragraphProperties.setBackgroundColor(ColorRegistry.getInstance().getColor(backgroundColor));
    }

    // border
    String border = ele.getFoBorderAttribute();
    if (StringUtils.isNotEmpty(border)) {
        paragraphProperties.setBorder(new StyleBorder(border, BorderType.ALL));
    }
    // border-bottom
    String borderBottom = ele.getFoBorderBottomAttribute();
    if (StringUtils.isNotEmpty(borderBottom)) {
        paragraphProperties.setBorderBottom(new StyleBorder(borderBottom, BorderType.BOTTOM));
    }

    // border-left
    String borderLeft = ele.getFoBorderLeftAttribute();
    if (StringUtils.isNotEmpty(borderLeft)) {
        paragraphProperties.setBorderLeft(new StyleBorder(borderLeft, BorderType.LEFT));
    }

    // border-bottom
    String borderRight = ele.getFoBorderRightAttribute();
    if (StringUtils.isNotEmpty(borderRight)) {
        paragraphProperties.setBorderRight(new StyleBorder(borderRight, BorderType.RIGHT));
    }

    // border-top
    String borderTop = ele.getFoBorderTopAttribute();
    if (StringUtils.isNotEmpty(borderTop)) {
        paragraphProperties.setBorderTop(new StyleBorder(borderTop, BorderType.TOP));
    }

    // line-height
    String lineHeight = ele.getFoLineHeightAttribute();
    if (StringUtils.isNotEmpty(lineHeight)) {
        paragraphProperties.setLineHeight(new StyleLineHeight(ODFUtils.getDimensionAsPoint(lineHeight),
                ODFUtils.hasPercentUnit(lineHeight)));
    }

    // margin
    String margin = ele.getFoMarginAttribute();
    if (StringUtils.isNotEmpty(margin)) {
        paragraphProperties.setMargin(ODFUtils.getDimensionAsPoint(margin));
    }

    // margin-bottom
    String marginBottom = ele.getFoMarginBottomAttribute();
    if (StringUtils.isNotEmpty(marginBottom)) {
        paragraphProperties.setMarginBottom(ODFUtils.getDimensionAsPoint(marginBottom));
    }

    // margin-left
    String marginLeft = ele.getFoMarginLeftAttribute();
    if (StringUtils.isNotEmpty(marginLeft)) {
        paragraphProperties.setMarginLeft(ODFUtils.getDimensionAsPoint(marginLeft));
    }

    // margin-right
    String marginRight = ele.getFoMarginRightAttribute();
    if (StringUtils.isNotEmpty(marginRight)) {
        paragraphProperties.setMarginRight(ODFUtils.getDimensionAsPoint(marginRight));
    }

    // margin-top
    String marginTop = ele.getFoMarginTopAttribute();
    if (StringUtils.isNotEmpty(marginTop)) {
        paragraphProperties.setMarginTop(ODFUtils.getDimensionAsPoint(marginTop));
    }

    // padding
    String padding = ele.getFoPaddingAttribute();
    if (StringUtils.isNotEmpty(padding)) {
        // cssStyleSheet.setCSSProperty("padding", padding);
    }

    // padding-bottom
    String paddingBottom = ele.getFoPaddingBottomAttribute();
    if (StringUtils.isNotEmpty(paddingBottom)) {
        // cssStyleSheet.setCSSProperty("padding-bottom", paddingBottom);
    }

    // padding-left
    String paddingLeft = ele.getFoPaddingLeftAttribute();
    if (StringUtils.isNotEmpty(paddingLeft)) {
        // cssStyleSheet.setCSSProperty("padding-left", paddingLeft);
    }

    // padding-bottom
    String paddingRight = ele.getFoPaddingRightAttribute();
    if (StringUtils.isNotEmpty(paddingRight)) {
        // cssStyleSheet.setCSSProperty("padding-right", paddingRight);
    }

    // padding-top
    String paddingTop = ele.getFoPaddingTopAttribute();
    if (StringUtils.isNotEmpty(paddingTop)) {
        // cssStyleSheet.setCSSProperty("padding-top", paddingTop);
    }

    // text-align
    String textAlign = ele.getFoTextAlignAttribute();
    if (StringUtils.isNotEmpty(textAlign)) {
        int alignment = Element.ALIGN_UNDEFINED;
        if ("start".equals(textAlign)) {
            alignment = Element.ALIGN_LEFT;
        } else if ("end".equals(textAlign)) {
            alignment = Element.ALIGN_RIGHT;
        } else if ("left".equals(textAlign)) {
            alignment = Element.ALIGN_LEFT;
        } else if ("right".equals(textAlign)) {
            alignment = Element.ALIGN_RIGHT;
        } else if ("center".equals(textAlign)) {
            alignment = Element.ALIGN_CENTER;
        } else if ("justify".equals(textAlign)) {
            alignment = Element.ALIGN_JUSTIFIED;
        }
        paragraphProperties.setAlignment(alignment);
    }

    // auto-text-indent
    Boolean autoTextIndent = ele.getStyleAutoTextIndentAttribute();
    if (autoTextIndent != null) {
        paragraphProperties.setAutoTextIndent(autoTextIndent);
    }

    // text-indent
    String textIndent = ele.getFoTextIndentAttribute();
    if (StringUtils.isNotEmpty(textIndent)) {
        paragraphProperties.setTextIndent(ODFUtils.getDimensionAsPoint(textIndent));
    }

    // keep-together
    String keepTogether = ele.getFoKeepTogetherAttribute();
    if (StringUtils.isNotEmpty(keepTogether)) {
        if (FoKeepTogetherAttribute.Value.ALWAYS.toString().equals(keepTogether)) {
            paragraphProperties.setKeepTogether(Boolean.TRUE);
        } else {
            paragraphProperties.setKeepTogether(Boolean.FALSE);
        }
    }

    // fo:break-before
    String breakBefore = ele.getFoBreakBeforeAttribute();
    if (StringUtils.isNotEmpty(breakBefore)) {
        if (FoBreakBeforeAttribute.Value.PAGE.toString().equals(breakBefore)) {
            paragraphProperties.setBreakBefore(StyleBreak.createWithPageBreak());
        } else if (FoBreakBeforeAttribute.Value.COLUMN.toString().equals(breakBefore)) {
            paragraphProperties.setBreakBefore(StyleBreak.createWithColumnBreak());
        } else {
            paragraphProperties.setBreakBefore(StyleBreak.createWithNoBreak());
        }
    }

    super.visit(ele);
}

From source file:org.odftoolkit.odfdom.converter.internal.itext.styles.StyleParagraphProperties.java

License:Open Source License

public void merge(StyleParagraphProperties paragraphProperties) {
    if (paragraphProperties.getAlignment() != Element.ALIGN_UNDEFINED) {
        alignment = paragraphProperties.getAlignment();
    }//from  w  ww. j  a va2s. co m
    if (paragraphProperties.getAutoTextIndent() != null) {
        autoTextIndent = paragraphProperties.getAutoTextIndent();
    }
    if (paragraphProperties.getBackgroundColor() != null) {
        backgroundColor = paragraphProperties.getBackgroundColor();
    }
    if (paragraphProperties.getBorder() != null) {
        border = paragraphProperties.getBorder();
    }
    if (paragraphProperties.getBorderBottom() != null) {
        borderBottom = paragraphProperties.getBorderBottom();
    }
    if (paragraphProperties.getBorderLeft() != null) {
        borderLeft = paragraphProperties.getBorderLeft();
    }
    if (paragraphProperties.getBorderRight() != null) {
        borderRight = paragraphProperties.getBorderRight();
    }
    if (paragraphProperties.getBorderTop() != null) {
        borderTop = paragraphProperties.getBorderTop();
    }
    if (paragraphProperties.getBreakBefore() != null) {
        breakBefore = paragraphProperties.getBreakBefore();
    }
    if (paragraphProperties.getKeepTogether() != null) {
        keepTogether = paragraphProperties.getKeepTogether();
    }
    if (paragraphProperties.getLineHeight() != null) {
        lineHeight = paragraphProperties.getLineHeight();
    }
    if (paragraphProperties.getMargin() != null) {
        margin = paragraphProperties.getMargin();
    }
    if (paragraphProperties.getMarginBottom() != null) {
        marginBottom = paragraphProperties.getMarginBottom();
    }
    if (paragraphProperties.getMarginLeft() != null) {
        marginLeft = paragraphProperties.getMarginLeft();
    }
    if (paragraphProperties.getMarginRight() != null) {
        marginRight = paragraphProperties.getMarginRight();
    }
    if (paragraphProperties.getMarginTop() != null) {
        marginTop = paragraphProperties.getMarginTop();
    }
    if (paragraphProperties.getTextIndent() != null) {
        textIndent = paragraphProperties.getTextIndent();
    }
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.itext.PatchRtfCell.java

License:Open Source License

/**
 * Imports the Cell properties into the PatchRtfCell
 *
 * @param cell//  ww w  . ja va2  s  . c om
 *          The Cell to import
 */
private void importCell(Cell cell) {
    this.content = new ArrayList<RtfBasicElement>();

    if (cell == null) {
        this.borders = new PatchRtfBorderGroup(this.document, PatchRtfBorder.CELL_BORDER,
                this.parentRow.getParentTable().getBorders());
        return;
    }

    if (cell instanceof PatchRtfCell) {
        PatchRtfCell rtfCell = (PatchRtfCell) cell;
        this.minimumHeight = rtfCell.minimumHeight;
    }

    this.colspan = cell.getColspan();
    this.rowspan = cell.getRowspan();
    if (cell.getRowspan() > 1) {
        this.mergeType = MERGE_VERT_PARENT;
    }
    if (cell instanceof PatchRtfCell) {
        this.borders = new PatchRtfBorderGroup(this.document, PatchRtfBorder.CELL_BORDER,
                ((PatchRtfCell) cell).getBorders());
    } else {
        this.borders = new PatchRtfBorderGroup(this.document, PatchRtfBorder.CELL_BORDER, cell.getBorder(),
                cell.getBorderWidth(), cell.getBorderColor());
    }
    this.verticalAlignment = cell.getVerticalAlignment();
    if (cell.getBackgroundColor() == null) {
        this.backgroundColor = new RtfColor(this.document, 255, 255, 255);
    } else {
        this.backgroundColor = new RtfColor(this.document, cell.getBackgroundColor());
    }

    this.cellPadding = (int) this.parentRow.getParentTable().getCellPadding();

    Iterator cellIterator = cell.getElements();
    Paragraph container = null;
    while (cellIterator.hasNext()) {
        try {
            Element element = (Element) cellIterator.next();
            // should we wrap it in a paragraph
            if (!(element instanceof Paragraph) && !(element instanceof List)) {
                if (container != null) {
                    container.add(element);
                } else {
                    container = new Paragraph();
                    container.setAlignment(cell.getHorizontalAlignment());
                    container.add(element);
                }
            } else {
                if (container != null) {
                    RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(container);
                    for (int i = 0; i < rtfElements.length; i++) {
                        rtfElements[i].setInTable(true);
                        this.content.add(rtfElements[i]);
                    }
                    container = null;
                }
                // if horizontal alignment is undefined overwrite
                // with that of enclosing cell
                if (element instanceof Paragraph
                        && ((Paragraph) element).getAlignment() == Element.ALIGN_UNDEFINED) {
                    ((Paragraph) element).setAlignment(cell.getHorizontalAlignment());
                }

                RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(element);
                for (int i = 0; i < rtfElements.length; i++) {
                    rtfElements[i].setInTable(true);
                    this.content.add(rtfElements[i]);
                }
            }
        } catch (DocumentException de) {
            de.printStackTrace();
        }
    }
    if (container != null) {
        try {
            RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(container);
            for (int i = 0; i < rtfElements.length; i++) {
                rtfElements[i].setInTable(true);
                this.content.add(rtfElements[i]);
            }
        } catch (DocumentException de) {
            de.printStackTrace();
        }
    }
}

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.itext.PatchRtfCell.java

License:Open Source License

/**
 * Imports the Cell properties into the PatchRtfCell
 *
 * @param cell/* ww  w  . ja v a 2s . c o  m*/
 *          The PdfPCell to import
 * @since 2.1.3
 */
private void importCell(PdfPCell cell) {
    this.content = new ArrayList<RtfBasicElement>();

    if (cell == null) {
        this.borders = new PatchRtfBorderGroup(this.document, PatchRtfBorder.CELL_BORDER,
                this.parentRow.getParentTable().getBorders());
        return;
    }

    // padding
    this.cellPadding = (int) this.parentRow.getParentTable().getCellPadding();
    this.cellPaddingBottom = cell.getPaddingBottom();
    this.cellPaddingTop = cell.getPaddingTop();
    this.cellPaddingRight = cell.getPaddingRight();
    this.cellPaddingLeft = cell.getPaddingLeft();

    // BORDERS
    this.borders = new PatchRtfBorderGroup(this.document, PatchRtfBorder.CELL_BORDER, cell.getBorder(),
            cell.getBorderWidth(), cell.getBorderColor());

    // border colors
    this.border = cell.getBorder();
    this.borderColor = cell.getBorderColor();
    this.borderColorBottom = cell.getBorderColorBottom();
    this.borderColorTop = cell.getBorderColorTop();
    this.borderColorLeft = cell.getBorderColorLeft();
    this.borderColorRight = cell.getBorderColorRight();

    // border widths
    this.borderWidth = cell.getBorderWidth();
    this.borderWidthBottom = cell.getBorderWidthBottom();
    this.borderWidthTop = cell.getBorderWidthTop();
    this.borderWidthLeft = cell.getBorderWidthLeft();
    this.borderWidthRight = cell.getBorderWidthRight();

    this.colspan = cell.getColspan();
    this.rowspan = 1; // cell.getRowspan();
    // if(cell.getRowspan() > 1) {
    // this.mergeType = MERGE_VERT_PARENT;
    // }

    this.verticalAlignment = cell.getVerticalAlignment();

    if (cell.getBackgroundColor() == null) {
        this.backgroundColor = new RtfColor(this.document, 255, 255, 255);
    } else {
        this.backgroundColor = new RtfColor(this.document, cell.getBackgroundColor());
    }

    // does it have column composite info?
    java.util.List compositeElements = cell.getCompositeElements();
    if (compositeElements != null) {
        Iterator cellIterator = compositeElements.iterator();
        // does it have column info?
        Paragraph container = null;
        while (cellIterator.hasNext()) {
            try {
                Element element = (Element) cellIterator.next();
                // should we wrap it in a paragraph
                if (!(element instanceof Paragraph) && !(element instanceof List)) {
                    if (container != null) {
                        container.add(element);
                    } else {
                        container = new Paragraph();
                        container.setAlignment(cell.getHorizontalAlignment());
                        container.add(element);
                    }
                } else {
                    if (container != null) {
                        RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(container);
                        for (int i = 0; i < rtfElements.length; i++) {
                            rtfElements[i].setInTable(true);
                            this.content.add(rtfElements[i]);
                        }
                        container = null;
                    }
                    // if horizontal alignment is undefined overwrite
                    // with that of enclosing cell
                    if (element instanceof Paragraph
                            && ((Paragraph) element).getAlignment() == Element.ALIGN_UNDEFINED) {
                        ((Paragraph) element).setAlignment(cell.getHorizontalAlignment());
                    }

                    RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(element);
                    for (int i = 0; i < rtfElements.length; i++) {
                        rtfElements[i].setInTable(true);
                        this.content.add(rtfElements[i]);
                    }
                }
            } catch (DocumentException de) {
                de.printStackTrace();
            }
        }
        if (container != null) {
            try {
                RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(container);
                for (int i = 0; i < rtfElements.length; i++) {
                    rtfElements[i].setInTable(true);
                    this.content.add(rtfElements[i]);
                }
            } catch (DocumentException de) {
                de.printStackTrace();
            }
        }
    }

    // does it have image info?

    Image img = cell.getImage();
    if (img != null) {
        try {
            RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(img);
            for (int i = 0; i < rtfElements.length; i++) {
                rtfElements[i].setInTable(true);
                this.content.add(rtfElements[i]);
            }
        } catch (DocumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    // does it have phrase info?
    Phrase phrase = cell.getPhrase();
    if (phrase != null) {
        try {
            RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(phrase);
            for (int i = 0; i < rtfElements.length; i++) {
                rtfElements[i].setInTable(true);
                this.content.add(rtfElements[i]);
            }
        } catch (DocumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    // does it have table info?
    PdfPTable table = cell.getTable();
    if (table != null) {
        this.add(table);
        // try {
        // RtfBasicElement[] rtfElements = this.document.getMapper().mapElement(table);
        // for (int i = 0; i < rtfElements.length; i++) {
        // rtfElements[i].setInTable(true);
        // this.content.add(rtfElements[i]);
        // }
        // } catch (DocumentException e) {
        // // TODO Auto-generated catch block
        // e.printStackTrace();
        // }
    }

}