Title: RE: Leading in cell of PdfPTable

That's a bizarre requirement and it's not supported (why should it be?).
You'll have to draw the text yourself.

Best Regards,
Paulo Soares

    -----Original Message-----
    From:   Jaladurgam, Ramana [SMTP:[EMAIL PROTECTED]
    Sent:   Tuesday, December 02, 2003 17:36
    To:     [EMAIL PROTECTED]
    Cc:     Paulo Soares
    Subject:        Leading in cell of PdfPTable

     Hello,
      I wanted to set the leading in PdfPCell as 1.2 times the height of the
    previous line.
      I am using the following code to do that:
               public static void main(String[] args)
        {
            Document document = new Document();
            try
            {

                PdfWriter lPdfWriter = PdfWriter.getInstance(document , new
    FileOutputStream("TextBlock.pdf"));
                document.open();
                PdfPTable lPdfPTable = new PdfPTable(1);
     
    lPdfPTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
     
    lPdfPTable.getDefaultCell().setVerticalAlignment(Element.ALIGN_TOP);
                lPdfPTable.getDefaultCell().setBorderWidth(1);
                lPdfPTable.getDefaultCell().setFixedHeight(100);
                lPdfPTable.setTotalWidth(100);
                lPdfPTable.getDefaultCell().setLeading(0 , 1.2f);
                Phrase p = new Phrase();
                //p.setLeading(5.0f);
                p.add(new Chunk("First Chunkg",
    FontFactory.getFont(FontFactory.HELVETICA , 24, Font.ITALIC, new
    java.awt.Color(255, 0, 0))));
                //p.add(Chunk.NEWLINE);
                p.add(new Chunk("Sec Chunk",
    FontFactory.getFont(FontFactory.HELVETICA, 8, Font.ITALIC, new
    java.awt.Color(255, 0, 0))));
                p.add(new Chunk("Third Chunk",
    FontFactory.getFont(FontFactory.HELVETICA, 8, Font.ITALIC, new
    java.awt.Color(255, 0, 0))));
                lPdfPTable.addCell(p);
                lPdfPTable.writeSelectedRows(0 , -1 , 200 , 600 ,
    lPdfWriter.getDirectContent());
            }
            catch (DocumentException de)
            {
                System.err.println(de.getMessage());
            }
            catch (IOException ioe)
            {
                System.err.println(ioe.getMessage());
            }
            document.close();

        }

     But the last line doesn't have the required leading. It appears that the
    line leading is depending on the font size of the last chunk written in that
    line. What I wanted is to set the leading to 1.2 times the height of the
    previous line. How to achieve this?
     I am also attaching the output pdf file..

    Regards
    Ramana.JV.


    ****************************************************************************
    This email may contain confidential material.
    If you were not an intended recipient,
    Please notify the sender and delete all copies.
    We may monitor email to and from our network.
    **************************************************************************** << File: TextBlock.pdf >>

Reply via email to