Paulo Soares <psoares <at> consiste.pt> writes:
>
> If the nested table is rotated 90 or 270 you must set the nested table width
> with setTotalWidth().
Thank you.
That did not work, but I was able to make the nested table appear, by calling
setFixedHeight(190.0f) on the containing cell (code below).
It there any way to force a kind of automatic layout? I.e. to find out the value
to give to setFixedHeight?
Thank you again.
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfPCell;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfWriter;
public class Rotating {
public static void main(String[] args) {
Document document = new Document(PageSize.A4);
try {
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("Rotating.pdf"));
document.open();
PdfPTable table = new PdfPTable(1);
PdfPTable t1 = new PdfPTable(2);
t1.addCell("c00");
t1.addCell("long line that gets wrapped?");
t1.addCell("c01");
t1.addCell("long line that gets wrapped?");
PdfPCell c0 = new PdfPCell();
c0.setRotation(90);
c0.addElement(t1);
c0.setFixedHeight(190.0f);
table.addCell(c0);
document.add(table);
} catch (Exception de) {
de.printStackTrace();
}
document.close();
}
}
> Paulo
>
> ----- Original Message -----
> From: "Andrea Lombardoni" <andrea <at> lombardoni.ch>
> To: <itext-questions <at> lists.sourceforge.net>
> Sent: Saturday, March 17, 2007 3:15 PM
> Subject: [iText-questions] iText 2.0.1 - PdfPCell setRotation
> 90 -Disappearing text
>
> > There seems to be a problem with nested PdfPTable and PdfPCell
> > setRotation.
> >
> > When running the following example, a table with no content is generated.
> >
> > If the setRotation is changed to 180 or removed completely, the the output
> > is
> > correct.
> >
> > import java.io.FileOutputStream;
> >
> > import com.lowagie.text.Document;
> > import com.lowagie.text.PageSize;
> > import com.lowagie.text.pdf.PdfPCell;
> > import com.lowagie.text.pdf.PdfPTable;
> > import com.lowagie.text.pdf.PdfWriter;
> >
> > public class Rotating {
> >
> > public static void main(String[] args) {
> >
> > Document document = new Document(PageSize.A4);
> > try {
> > PdfWriter writer = PdfWriter.getInstance(document,
> > new
> > FileOutputStream("Rotating.pdf"));
> > document.open();
> >
> > PdfPTable table = new PdfPTable(1);
> > PdfPTable t1 = new PdfPTable(2);
> > t1.addCell("c0");
> > t1.addCell("c1");
> > t1.addCell("c2");
> > t1.addCell("c3");
> > PdfPCell c0 = new PdfPCell();
> > //the next line is the responsible!!!
> > c0.setRotation(90);
> > c0.addElement(t1);
> > table.addCell(c0);
> > document.add(table);
> >
> > } catch (Exception de) {
> > de.printStackTrace();
> > }
> > document.close();
> > }
> > }
> >
> >
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your
> > opinions on IT & business topics through brief surveys-and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > iText-questions mailing list
> > iText-questions <at> lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > Buy the iText book: http://itext.ugent.be/itext-in-action/
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> iText-questions <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/