[英]How can i set column width or other property or apply css to table while generating PDF through itextsharp & RazorPDF dlls
<html>
<body>
<h3 align="center"><b>Print Card</b></h3>
<table border="1">
<tr>
<td></td>
<td><b>Start of Shift</b></td>
<td><b>End of Shift</b></td>
<td></td>
</tr>
<tr>
<td>Debit Total:</td>
<td>£24.00</td>
<td>£22.00 </td>
<td>(£2.00)</td>
</tr>
<tr>
<td>Credit Total:</td>
<td>£32.00</td>
<td>£30.00</td>
<td>(£2.00)</td>
</tr>
</table>
</body>
</html>
I wrote above in my Print.cshtml
. 我在上面的
Print.cshtml
写道。 And my Controller Action method is as below. 我的Controller Action方法如下。
public ActionResult PrintCard()
{
Transactions transationsShift = new Transactions();
transationsShift = transationsShift.GetShiftData();
return new RazorPDF.PdfResult(transationsShift, "Print");
}
Which generated below PDF. 生成下面的PDF。
But the first column of table is by default is too wide. 但是表的第一列默认情况下太宽。 I want to set width of each column manually which i am not able to do.
我想手动设置每列的宽度,但我无法做到。
I tried to apply css class to table but no luck. 我试图将CSS类应用于表,但是没有运气。
style="width:25%"
to each column but not getting applied. style="width:25%"
,但未应用。 :( :(
How can I do that? 我怎样才能做到这一点? Any suggestions are welcome!
欢迎任何建议!
Thanks in advance. 提前致谢。 :)
:)
我在转换为PDF时遇到了这个问题,我首先转换为Excel工作表,然后在其中设置列宽,然后将Excel转换为PDF。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.