Hi everybody,
I found a strange behaviour when the following construst ist made
  cell
    list
      listitem
        newline

This newline does not only break the line but adds lots of space 
between the broken lines.

This behaviour does only occur when the list resides inside a cell,
pure lists/listitems doesn't have a problem.

See the code below. Any ideas?

Thanks in advance,
        Peter


Here some sample code for testing
---------------------------------

public class ListitemInCell {

        public static void main(String[] args) {
                Document document = new Document(PageSize.A4, 50, 50, 50,
50);
                try {
                        PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("d:/temp/itexttests/ListItemInCell.pdf"));
                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        document.newPage();
                        Table table = new Table(1);
                        table.setPadding(2f);
                        Cell aCell = new Cell();
                        aCell.add(new Chunk("this is a text with newline"));
                        aCell.add(Chunk.NEWLINE);
                        aCell.add(new Chunk("that works fine"));
                        table.addCell(aCell);

                        Cell aSecondCell = new Cell();
                        List aList = new List(false, 20);
                        ListItem aListItem = new ListItem("another text with
newline");
                        aListItem.add(Chunk.NEWLINE);
                        aListItem.add(new Chunk("but with a big gap"));
                        aList.add(aListItem);

                        ListItem aListItem2 = new ListItem("this
linebreak\nlistitem looks ok! Lets have a little more text to see the
natural line break");
                        aList.add(aListItem2);

                        aSecondCell.add(aList);
                        table.addCell(aSecondCell);

                        document.add(table);
                        document.close();
                        System.out.println("Finished.");
                }
                catch (Exception e) {
                        e.printStackTrace();
                }
        }
}


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to