Kumar:

Even with the suggested solution, your table is not going to work very well.
For example, setWidths() does not work the way you're using it. Secondly,
why are you using a command that sets the alignment for all cells to right,
and then setting individual cells to right? 

I am fairly sure this is what Paulo meant when he said you need to repost
this question. He's right. You have not understood how tables are created.
Start by studying chapter 6 in the book.

---mr. bean


Thilip Kumar S wrote:
> 
> Hi
>  
>       Im trying to generate the PDF with 3 column. My requirement is , I
> need to have 3 columns in report, Say "Cust Name", "Account No", "Paid
> Amount". 
>  
>     In this case, the first 2 cells should be aligned left, the 3rd one
> should be aligned right , as its a numeric value. 
>  
> Im trying like the below.,
>  
>    PdfPTable pTable = new PdfPTable(3);
>    pTable.setWidthPercentage(100);
>    pTable.setWidths(new float[] {0,80,20});
>    pTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT); 
>    pTable.getDefaultCell().setBorder(Rectangle.NO_BORDER);
>    Phrase p1 = new Phrase(arr[0],colFont);
>    Phrase p2 = new Phrase(arr[4],colFont);
>    
>    PdfPCell pcell = new PdfPCell();
>    pcell.setBorderWidth(0);
>    pcell.setHorizontalAlignment(Element.ALIGN_RIGHT);
>    pcell.setBorder(Rectangle.NO_BORDER);
>    pcell.disableBorderSide(PdfPCell.BOTTOM);
>    pTable.addCell(pcell);
>    
>  
>    pTable.addCell(p1);
>    pTable.addCell(p2);
>    pTable.addCell("");
>    
>  
>  
> "getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT)" will align
> the whole table in to right. But im my case , the Phrase "p1" alone should
> be aligned RIGHT.
>  
> Can anyone help me.
>  
> Thanks in Advance
>  
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Check the site with examples before you ask questions:
> http://www.1t3xt.info/examples/
> You can also search the keywords list:
> http://1t3xt.info/tutorials/keywords/
> 

-- 
View this message in context: 
http://www.nabble.com/Cell-Alignment-tp25504786p25505623.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to