Here is the source code, very simple :

Document doc = new Document(PageSize.A4);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream(@"C:\test.pdf", 
FileMode.Create));

doc.Open();

PdfPTable table = new PdfPTable(1);
decimal amount = 2000.00m;
table.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
table.AddCell(new Phrase(amount.ToString("n2")));
table.AddCell(new Phrase(montant.ToString("0,000.00")));
table.AddCell(new Phrase("2 000,00"));

doc.Add(table);
doc.Close();



The problem appears using the C# decimal formatting. As I'm French, decimal are 
formatted as "2 000,00", so using ToString("n2") will transform my decimal to a 
string like "2 000,00". I had a custom formatting which forces to display the 
decimal as "2 000,00.

With 4.0.4, the result is ok (the 3 cells have the same formatting). Using 
4.0.7, the formatting of the 2 first cells are wrong.

Regards,

-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Paulo Soares
Envoyé : mardi 18 décembre 2007 16:00
À : Post all your questions about iText here
Objet : Re: [iText-questions] Strange behaviour on itextSharp 2.0.7

Post the code needed to reproduce the problem. I find this strange, iTextSharp 
doesn't do any number formatting.

Paulo 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of François Miermont
> Sent: Tuesday, December 18, 2007 2:52 PM
> To: 'Post all your questions about iText here'
> Subject: Re: [iText-questions] Strange behaviour on itextSharp 2.0.7
> 
> Ooops my bad, I'm talking about iTextSharp 4.0.4 & 4.0.7
> 
> -----Message d'origine-----
> De : [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] De la 
> part de Paulo Soares
> Envoyé : mardi 18 décembre 2007 15:20
> À : Post all your questions about iText here
> Objet : Re: [iText-questions] Strange behaviour on itextSharp 2.0.7
> 
> I don't think there's an iTextSharp 2.0.7. The version start 
> at 3.0.0 and is currently at 4.0.7. In any case support is 
> only given for the latest release.
> 
> Paulo 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On 
> > Behalf Of François Miermont
> > Sent: Tuesday, December 18, 2007 2:14 PM
> > To: [email protected]
> > Subject: [iText-questions] Strange behaviour on itextSharp 2.0.7
> > 
> > Hi all,
> > 
> >  
> > 
> > I’m using iTextSharp 2.0.4 to make some bills listing. Very 
> > simple in fact.
> > 
> >  
> > 
> > I have notice that using 2.0.7 I have a strange behavior with 
> > string formatting in a cell.
> > 
> >  
> > 
> > Using string = “2 000,00”, I have : 
> > 
> > -with 2.0.4, “2 000,00”
> > 
> > -with 2.0.7 “2000,00 “
> > 
> >  
> > 
> > I think it’s not working as intented.
> > 
> >  
> > 
> > Regards,


Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter 
informação confidencial ou legalmente protegida. A incorrecta transmissão desta 
mensagem não significa a perca de confidencialidade. Se esta mensagem for 
recebida por engano, por favor envie-a de volta para o remetente e apague-a do 
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de 
usar, revelar ou distribuir qualquer parte desta mensagem. 

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain 
confidential or legally protected information. The incorrect transmission of 
this message does not mean the loss of its confidentiality. If this message is 
received by mistake, please send it back to the sender and delete it from your 
system immediately. It is forbidden to any person who is not the intended 
receiver to use, distribute or copy any part of this message.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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/


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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