ColumnText only knows about text and its own formatting. You'll have to make
the list by hand if you want to use ColumnText.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Andrew Murphy [SMTP:[EMAIL PROTECTED]]
> Sent: Saturday, September 21, 2002 12:06
> To:   [EMAIL PROTECTED]
> Subject:      [iText-questions] Adding a List object to a ColumnText
> object (loss of formatting)
> 
> Hi folks
> 
> I need to create a page containing two columns (similar to example
> Chap1007
> in the sample code) which contains terms and conditions you would commonly
> find on the reverse of a delivery note or order. These terms need to be
> ordered i.e. list items which are numbered for ease of reference.
> 
> The sample code below illustrates what I am trying to achieve and shows
> that
> when you add a Phrase to the ColumnText object all List formatting is
> lost.
> 
> Please help.
> 
> Thanks, Andrew
> 
> <pre>
> 
> import java.io.FileOutputStream;
> import java.io.IOException;
> import com.lowagie.text.*;
> import com.lowagie.text.pdf.*;
> 
> public class ListsAndColumns {
>     public static void main(String[] args) {
>         String localFilepath =
> "E:\\TMP\\Examples\\iTextPDFexamples\\WEB-INF\\Classes\\";
>         Document document = new Document(PageSize.A4);
>         try {
>             PdfWriter writer = PdfWriter.getInstance(document, new
> FileOutputStream(localFilepath + "ListsAndColumns.pdf"));
>             document.open();
> 
>             document.add(new Phrase("Example of adding a List to a
> Document
> object"));
>             Phrase pList = new Phrase();
>             pList.add(getMyList());
>             document.add(pList);
> 
>             document.newPage();
>             document.add(new Phrase("Example of adding a List to a
> ColumnText object - all formatting lost!"));
>             ColumnText colText = new
> ColumnText(writer.getDirectContent());
>             colText.setSimpleColumn(document.left(), 0, document.right(),
> document.top()-25, 15, Element.ALIGN_JUSTIFIED);
>             colText.addText(pList);
>             colText.go();
> 
>         } catch(DocumentException de) {
>             System.err.println(de.getMessage());
>         } catch(IOException ioe) {
>             System.err.println(ioe.getMessage());
>         } finally {
>             document.close();
>         }
>     }
>     static List getMyList() {
>         List outerList = new List(true, false, 15);
>         outerList.add(new ListItem("Outer list item 1"));
>         List innerList = new List(false, true, 15);
>         innerList.add(new ListItem("Inner list item 1"));
>         innerList.add(new ListItem("Inner list item 2"));
>         outerList.add(innerList);
>         outerList.add(new ListItem("Outer list item 2"));
>         return outerList;
>     }
> }
> 
> </pre>
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to