如何在C#中将货币格式应用于itextsharp的pdftable数据 [英] How to Apply Currency Format to pdftable data of itextsharp in C#
本文介绍了如何在C#中将货币格式应用于itextsharp的pdftable数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨
我正在使用itextsharp在C#中执行代码,创建了pdf.
Hi
I am doing code in C# using itextsharp , creating pdf.
for (int i = 0; i < lst1.Count; i++)
{
PdfPCell cell6 = new PdfPCell(new Phrase(lst1[i].Price,new Font(FontFactory.GetFont("Helvetica",8 , BaseColor.DARK_GRAY))));
cellFormat(mytable, cell6);
}
我的数据正在显示-> 450457.5237
我想以货币格式显示此数据,例如$ 4,50,457.52
所以请帮助我.
My data is showing now -> 450457.5237
I want to display this data in currency format like $4,50,457.52
so please help me.
推荐答案
4,50,457.52
所以请帮助我.
4,50,457.52
so please help me.
假设小数点lst [i].价格是小数点
assuming decimal lst[i].Price is a decimal
decimal thePrice = lst[i].Price;
PdfPCell cell6 = new PdfPCell(new Phrase(thePrice.ToString("C") ,new Font(FontFactory.GetFont("Helvetica",8 , BaseColor.DARK_GRAY))));
非常感谢,它的工作原理是..:)
Thnk U so much , its working .. :)
这篇关于如何在C#中将货币格式应用于itextsharp的pdftable数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文