You are not getting the Phrase, just the first Chunk. You can use
ColumnText to place the phrase. Note that the original text is also
placed at 0 degrees so, this may not be what you want.
I'll put in my to do list the support for rotated text in cells.

Best Regards,
Paulo Soares

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Philip Petrescu
> Sent: Monday, August 23, 2004 9:16 AM
> To: [EMAIL PROTECTED]
> Subject: Re: [iText-questions] Vertical text in PdfPCell
> 
> Hi Paulo,
> 
> Thanks for your prompt reply.
> 
> As you can see from my example, I already got the Phrase from the
> cell. The question is, how do I tell it to display vertically?
> 
> Thanks for your time,
> 
> Philip
> 
> On Sun, 22 Aug 2004 20:40:25 +0100, Paulo Soares 
> <[EMAIL PROTECTED]> wrote:
> > You can call pdfPCell.getPhrase() to get the text.
> > 
> > Best Regards,
> > Paulo Soares
> > 
> > ----- Original Message -----
> > From: "Philip Petrescu" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Saturday, August 21, 2004 13:04
> > Subject: [iText-questions] Vertical text in PdfPCell
> > 
> > > Hi everyone,
> > >
> > > I know this question has been asked before, but I still 
> can't figure
> > > out what the answer is. I am trying to write the text within a
> > > PdfPCell vertically, instead of horizontally.
> > >
> > > I searched for this topic and found the following answer 
> from Paulo:
> > >
> > > "set the cell with a fixed height and use a PdfPCellEvent 
> to paint the
> > > text or whatever you want with the PdfContentByte provided."
> > >
> > > So that's what I tried to do (see the code below). The 
> problem is that
> > > in the cellLayout method from the MyCellEvent, I still 
> don't know how
> > > to tell the "existing" text from the cell to display vertically.
> > >
> > > I would really appreciate any help with this matter.
> > >
> > > Thanks for your time,
> > >
> > > Philip
> > >
> > > class MyCellEvent implements PdfPCellEvent
> > > {
> > >   public void cellLayout(PdfPCell pdfPCell, Rectangle rectangle,
> > >       PdfContentByte[] pdfContentBytes)
> > >   {
> > >     PdfContentByte cb = pdfContentBytes[PdfPTable.TEXTCANVAS];
> > >
> > >     // here I need to tell the cell that the text should 
> be displayed
> > vertically
> > >     // not horizontally, but I do not know how to do that.
> > >     cb.beginText();
> > >
> > >     Chunk chunk = (Chunk) pdfPCell.getPhrase().get(0);
> > >     cb.setFontAndSize(chunk.font().getBaseFont(), 
> chunk.font().size());
> > >
> > >     // as you can see, I was able to write an additional text here
> > (vertically)
> > >     // but this is not what I want. I need to tell the 
> text that is
> > already in
> > >     // the cell to be displayed vertically! How do I do that?
> > >     cb.setTextMatrix(0, 1, -1, 0, rectangle.right(), 
> rectangle.top());
> > >     cb.showText("Text");
> > >
> > >     cb.endText();
> > >   }
> > > }
> > >
> > > // create table
> > > PdfPTable table = new PdfPTable(4);
> > >
> > > Font font = ReportUtils.GetFont(10, Font.NORMAL, Color.BLACK);
> > > Chunk chunk = new Chunk(aCellString, font);
> > >
> > > // create cell
> > > PdfPCell cell = new PdfPCell(new Phrase(20, chunk));
> > > cell.setFixedHeight(100);
> > >
> > > // set cell event
> > > MyCellEvent event = new MyCellEvent();
> > > cell.setCellEvent(event);
> > >
> > > // add cell to table
> > > aTable.addCell(cell);
> > >
> > >
> > > -------------------------------------------------------
> > > SF.Net email is sponsored by Shop4tech.com-Lowest price 
> on Blank Media
> > > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> > > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> > > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> > > _______________________________________________
> > > iText-questions mailing list
> > > [EMAIL PROTECTED]
> > > https://lists.sourceforge.net/lists/listinfo/itext-questions
> > 
> >
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
> 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
> Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
> http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
> _______________________________________________
> iText-questions mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 


-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to