如何使用ASP.NET与C#在pdf中对齐表格中心?
问题描述:
我想使用带有c#的asp.net在pdf中对齐表格中心。我正在使用stringbuilder并将值附加到具有内联样式的表,同时使用itextsharp将html页面中的内容导出到pdf。但桌子已经完全伸展了。
我尝试过的事情:
以下是我的代码:
I want to align table center in the pdf using asp.net with c#. I am using stringbuilder and appending the values to a table with inline style while exporting contents in html page to pdf using itextsharp. But the table is coming fully stretched.
What I have tried:
Below is my code:
sb.Append("<table border=1 align='center' style='width:500px;text-align:center'>");
sb.Append("<tr>");
sb.Append("<td align='left' style='font-size:12pt;float:right;'>Cheque Number</td>");
sb.Append("<td align='left' style='font-size:12pt;float:right;'>Date</td>");
sb.Append("<td align='left' style='font-size:12pt;float:right;'>Drawee Bank</td>");
sb.Append("<td align='left' style='font-size:12pt;float:right;'>Return Reason</td>");
sb.Append("<td align='left' style='font-size:12pt;float:right;'>Amount</td>");
sb.Append("</tr>");
<pre> sb.Append("</table>");
答
你可以使用itextSharp第三部分DLL并使用它的对象你可以对齐表格
可以在下方可以提供帮助。
使用C#和iTextSharp在PDF中创建表格[ ^ ]
You can use the itextSharp third part DLL and using it's object you can align table
Might be below can help.
Create Table In PDF using C# And iTextSharp[^]