Thanks for the answer. But I tried the following code, the problem persists.

            StringBuilder sb = new StringBuilder();
            for(int i=0; i<100; i++) {
                sb.append("Line: ").append(i).append("\n");
            }
             PdfPTable tb = new PdfPTable(2);
            tb.setWidthPercentage(50);
            PdfPCell cell = new PdfPCell(new Phrase(sb.toString()));
            cell.setRowspan(2);
            tb.addCell(cell);

            cell = new PdfPCell(new Phrase("cell 0, 1"));
            tb.addCell(cell);
            cell = new PdfPCell(new Phrase("cell 1, 1"));
            tb.addCell(cell);
            doc.add(tb);


On Tue, Apr 12, 2011 at 11:13 AM, Nurettin DAG <nurettin...@gmail.com>wrote:

> I am wondering if this has to do with the two text modes supported with
> cells one being composite mode other being st else :) (I don t remember, you
> need to look at the book)
>
> I vaguely remember the details. However, the idea is that combination of
> the two in the same table is not supported. I believe cell.addElement
> triggers a composite mode whereas new PdfPCell(element); is the other one.
>
> I am not really sure about the details but it might help reading the table
> related chapter in the book and learn more about the modes.
>
> Good luck
> Nurettin
>
> On Tue, Apr 12, 2011 at 2:05 PM, Colin Cheng <colley...@gmail.com> wrote:
>
>> Is there anyone can help me? Thanks a lot.
>>
>> On Mon, Apr 11, 2011 at 4:24 PM, Colin Cheng <colley...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> When the cell with multi-row span contains long text, the table will not
>>> be rendered correctly. Thanks for any advice.
>>>
>>> Here is the code:
>>>
>>>         this.doc = new Document(PageSize.A4);
>>>         this.writer = PdfWriter.getInstance(doc, new
>>> FileOutputStream("test.pdf"));
>>>         doc.open();
>>>
>>>             PdfPTable tb = new PdfPTable(2);
>>>             tb.setWidthPercentage(50);
>>>             PdfPCell cell = new PdfPCell();
>>>             StringBuilder sb = new StringBuilder();
>>>             for(int i=0; i<50; i++) {
>>>                 sb.append("Line: ").append(i).append("\n");
>>>             }
>>>             cell.addElement(new Phrase(sb.toString()));
>>>             cell.setRowspan(2);
>>>             tb.addCell(cell);
>>>
>>>             cell = new PdfPCell(new Phrase("cell 0, 1"));
>>>             tb.addCell(cell);
>>>             cell = new PdfPCell(new Phrase("cell 1, 1"));
>>>             tb.addCell(cell);
>>>             doc.add(tb);
>>>
>>>         doc.close();
>>>
>>>
>>
>>
>> ------------------------------------------------------------------------------
>> Forrester Wave Report - Recovery time is now measured in hours and minutes
>> not days. Key insights are discussed in the 2010 Forrester Wave Report as
>> part of an in-depth evaluation of disaster recovery service providers.
>> Forrester found the best-in-class provider in terms of services and
>> vision.
>> Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
>> _______________________________________________
>> iText-questions mailing list
>> iText-questions@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> iText(R) is a registered trademark of 1T3XT BVBA.
>> Many questions posted to this list can (and will) be answered with a
>> reference to the iText book: http://www.itextpdf.com/book/
>> Please check the keywords list before you ask for examples:
>> http://itextpdf.com/themes/keywords.php
>>
>
>
>
> --
> Nurettin DAG
>
>
> ------------------------------------------------------------------------------
> Forrester Wave Report - Recovery time is now measured in hours and minutes
> not days. Key insights are discussed in the 2010 Forrester Wave Report as
> part of an in-depth evaluation of disaster recovery service providers.
> Forrester found the best-in-class provider in terms of services and vision.
> Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
Forrester Wave Report - Recovery time is now measured in hours and minutes
not days. Key insights are discussed in the 2010 Forrester Wave Report as
part of an in-depth evaluation of disaster recovery service providers.
Forrester found the best-in-class provider in terms of services and vision.
Read this report now!  http://p.sf.net/sfu/ibm-webcastpromo
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to