我使用比萨xhtml2pdf将html代码转换为pdf。
我有麻烦了!比萨并没有在我的桌子上应用一些样式,比如、身高、和。
<table style='overflow: hidden;' border='1' cellpadding='0' cellspacing='0'
width="300px">
<tr style="background-color : yellow; height:100px;">
<td style="color: red; height:100px; vertical-align: middle;">
A lot of data
</td></tr></table>但是在将这个html转换成pdf后,表格tds的高度和垂直对齐不正确!请帮帮我。
发布于 2013-03-07 15:12:11
您还需要为表指定一个高度(height:100px;)示例:
<table style='overflow: hidden; height:100px;' border='1' cellpadding='0' cellspacing='0' width="300px">
<tr style="background-color : yellow;height:100px;">
<td style="color: red; height:100px; vertical-align: middle;">
<!-- A lot of data -->
</td>
</tr>
</table>发布于 2018-04-30 07:20:25
我用这个黑客设法得到了细胞的高度:
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%" style="border: 1px solid #000"><!-- content goes here --></td>
<td width="0"><br><br><br><br><br></td><!-- special cell to keep the height of the table -->
</tr>
</table>第二个单元格是完全不可见的,上面的代码绘制一个宽度为100%的框,高度由第二个单元格中的s数或第一个单元格中的文本数量(以较长的值为准)定义。
https://stackoverflow.com/questions/13249738
复制相似问题