I might be way off base here, but isn't the problem that the text is
already in the cell? I'm not sure you can rotate text that has already been
written.

However, could you not use the cell as a storage object and do the
following:

1) Set up your cell and write the phrase into it (as you do at present)
2) In the CellEvent code, get the phrase you wrote out of the cell using
getPhrase
3) Remove the written text using setPhrase(new Phrase(""))
4) re-write the text into the cell, rotated using the method you described
as working?

Like I said, probably way off base, and I've not tried it.

Let me know if it helps.

Regards

Kieran


Kieran Metcalfe
Senior Software Developer
(Embedded image moved to file: pic06334.gif)
http://www.generation10.net
Office Phone Number: +44 151 255 1160
Cell Phone Number: +44 7746 383902
[EMAIL PROTECTED]


                                                                           
             Philip Petrescu                                               
             <philip.petrescu@                                             
             gmail.com>                                                 To 
             Sent by:                  [EMAIL PROTECTED] 
             itext-questions-a         et                                  
             [EMAIL PROTECTED]                                          cc 
             forge.net                                                     
                                                                   Subject 
                                       Re: [iText-questions] Vertical text 
             23/08/2004 09:15          in PdfPCell                         
                                                                           
                                                                           
             Please respond to                                             
              Philip Petrescu                                              
             <philip.petrescu@                                             
                gmail.com>                                                 
                                                                           
                                                                           




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

<<attachment: pic06334.gif>>

Reply via email to