在C#中导出为PDF - 如何在排列项目时使用十进制值 [英] Exporting to PDF in C# - how to use Decimal value in arranging items

查看:96
本文介绍了在C#中导出为PDF - 如何在排列项目时使用十进制值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在研究C#中的一个项目,其中我必须将数据库值导出为PDF文件。



我必须在PDF上安排数据网格值,所以我设置 PRESENTd.Colspan = 2 这是一个整数。 br />
我通常观察到如果我必须输入1.5,那么它不考虑十进制值,n考虑整数。



如何我可以分配小数值吗?



亲切的帮助!



我的代码 -

Hi,

I am working on a a project in C#, wherein I have to export the database values to a PDF file.

I have to arrange the data grid values on the PDF, so i set my PRESENTd.Colspan = 2 which is a whole number.
I have commonly observed that if I have to type 1.5, then it does not consider decimal values, n considers a whole number.

How can I assign decimal value??

kindly help!

My Code -

PdfPCell PRESENTd = new PdfPCell(new Paragraph(dataGridView1.Rows[i1].Cells["PresentReading"].Value.ToString(), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 12)));
PRESENTd.Colspan = 2;
PRESENTd.MinimumHeight = 20f;
table.AddCell(PRESENTd);

推荐答案

Colspan 是用于指定单元格跨越多少列。

您只能跨越完整列,因此该属性仅排除整数值。



请参阅 iTextSharp - 介绍表 [ ^ ]
Colspan is used to specify how many columns are being spanned by the cell.
You can only span complete columns hence the property only excepts integer values.

See iTextSharp - Introducing Tables[^]


这篇关于在C#中导出为PDF - 如何在排列项目时使用十进制值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆