The question really is, when you want formatting in a Cell, you have
to add a Phrase to the Cell.  When you add any element to a Cell,
other than a String, wrapping does not work.  Is this the expected
behavior?

Thanks,

-jay

On Apr 5, 2005 9:44 AM, Jay Blanton <[EMAIL PROTECTED]> wrote:
> This method creates a table that I add to the document.  I have a
> method that is used to create cell headers and cells.
> 
>    protected Table createTable()
>    {
>        Table table;
>        PdfPTable pdfTable;
>        try
>        {
>            table = new Table(2, 2);
>            table.setBorder(1);
>            table.setWidth(100.0f);
>            table.setSpaceInsideCell(3.0f);
>            table.setAutoFillEmptyCells(true);
>            table.addCell(this.createCellHeader(COLUMN_1_HDR,
> HEADER_FONT), 0, 0);
>            table.addCell(this.createCellHeader(COLUMN_2_HDR,
> HEADER_FONT) 0, 1);
>            table.addCell(this.createCell(this.createValue(TEST_SAMPLE_DATA,
> HEADER_FONT)), 1, 0);
>            table.addCell(this.createCell(this.createValue(TEST_SAMPLE_DATA,
> HEADER_FONT)), 1, 1);
>        }
>        catch (BadElementException e)
>        {
>            // TODO Auto-generated catch block
>            throw new DocumentConverterException("Failed to create
> care plan details: ", e);
>        }
>        return table;
>    }
> 
> My method createCell looks like the following.  There are two issues,
> the align in middle does not work and the wrap does not work.  My
> TEST_SAMPLE_DATA field is a few lines long and when I run my test, I
> am missing half of the string because it does not wrap.
> 
>    protected Cell createCell(Element element)
>    {
>        Cell cell;
>        try
>        {
>            cell = new Cell();
>            cell.addElement(element);
>            cell.setLeading(CELL_FONT_LEADING);
>            cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
>            cell.setNoWrap(false);
>        }
>        catch (BadElementException e)
>        {
>            // TODO Auto-generated catch block
>            throw new DocumentConverterException("Failed to create
> care plan details: ", e);
>        }
>        return cell;
>    }
> 
> Any thoughts on why this is incorrect?
> 
> Thanks--
> --
> jay blanton
> [EMAIL PROTECTED]
> 


-- 
jay blanton
[EMAIL PROTECTED]
(c) 916-715-1529


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to