You'll have to first simulate if the paragraph fits and then write it in the
same column or the next. Note that the simulation destroys the instance and
a new ColumnText instance must be created.
Best Regards,
Paulo Soares
----- Original Message -----
From: "Guillermo Gonz�lez" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, July 30, 2003 2:44
Subject: [iText-questions] Keeping paragraphs together with ColumnTExt
> Hi,
>
> It is posible to let a whole paragraph to remain together if a
> NO_MORE_COLUMN is reached using ColumnText and you change to another
> column?
>
> I'm using the following code:
>
>
> float[] right = {50, 300};
> float[] left = {290, 550};
> int leading = 11;
>
> ct.setSimpleColumn(right[0], 25, left[0], 800, leading,
> Element.ALIGN_LEFT);
>
> int column = 0;
> int n_columns = 2;
>
> while(rs.next()) {
> Phrase p = new Phrase();
> p.add(new Chunk("\n" + rs.getString("nombre"), titulo));
> p.add(new Chunk("\n" + rs.getString("direccion") + "\n",
> direccion));
> ct.addText(p);
>
> if (ct.go() == ct.NO_MORE_COLUMN)
> {
> column++;
> if (column > n_columns - 1) {
> document.newPage();
> column = 0;
> }
>
> ct.setSimpleColumn(right[column], 25, left[column], 800, leading,
> Element.ALIGN_LEFT);
> }
> }
>
> Regards,
> Guillermo
>
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions