I think the best option would be to add a 'decimal aligned' in  
addition to left,right,center,right aligned.

It shouldn't be too difficult.

First, using desired font:

Determine the width of the largest number, and calculate ((X+1) * the  
number of decimal places). This is the right hand offset. = RHO.

Then calculate the string width to the decimal point = DW.
Use RHM as the right hand margin location.

Finally, draw the string at RHM-RHO-DW.

A simpler solution might be to use a fixed space font, then a ' ' and  
a ')' would be the same size.



On Jan 12, 2007, at 6:14 AM, Bruno Lowagie (iText) wrote:

> Rick Roen wrote:
>> How about adding a Chunk to the end of a positive number that  
>> contains a
>> “)” character and make the font.color = color.white?
>
> The problem is that you never know what people are going
> to do with the report. If they copy/paste the numbers,
> the ')' will still be there.
> Also if the background color of the cells isn't white,
> you'll still see the ')'. It might be better to set
> the rendition of the Chunk to invisible.
>
>> If you are putting these numbers in a PdfPTable, you could use two
>> different PdfPCell’s with different padding for the right to offset a
>> positive number.
>
> I like this idea. It's simple to achieve and elegant
> PDF-syntax-wise: no fake characters are introduced.
> Just a different positioning. I'd try this suggestion
> first if I ever encountered this problem. Thanks!
> best regards,
> Bruno
>
> ---------------------------------------------------------------------- 
> ---
> 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/


-------------------------------------------------------------------------
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/

Reply via email to