php - 如何在 tcpdf 中创建垂直侧标题表
问题描述
当我使用这种方法时,表格的标题是水平的,而不是垂直的。
$link= mysqli_connect($host, $user, $pass, $db);
if (isset($_GET['eid']))
{
$eid=$_GET['eid'];
}
$output = '';
$count=0;
$sql = "SELECT * FROM event_record where eventID='{$eid}' ";
$result = mysqli_query($link, $sql);
while($row = mysqli_fetch_array($result))
{
$count++;
$output .= "<tr>
<td>$count</td>
<td>{$row['studentID']}</td>
<td>{$row['studentName']}</td>
<td>{$row['contact']}</td>
<td>{$row['program']}</td>
<td>{$row['booking_date']}</td>
<td>{$row['booking_type']}</td>
</tr>
";
}
return $output;
我想要 pdf 的结果是,表格标题在垂直和左侧,而不是水平。
<table class="table table-bordered">
<tr>
<th width="3%">No.</th>
<th width="10%">Student ID</th>
<th width="10%">Student Name</th>
<th width="10%">Contact</th>
<th width="5%">Program</th>
<th width="8%">Booking Date</th>
<th width="10%">Booking Type</th>
</tr>
<?php
echo fetch_data();
?>
</table>
下面的代码是合并值和表格标题
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<th width="5%">No.</th>
<th width="15%">Student ID</th>
<th width="20%">Student Name</th>
<th width="15%">Contact</th>
<th width="10%">Program</th>
<th width="15%">Booking Date</th>
<th width="15%">Booking Type</th>
</tr>
';
$content .= fetch_data();
$content .= '</table>';
$obj_pdf->writeHTML($content);
$obj_pdf->Output('file.pdf', 'I');
解决方案
推荐阅读
- android - 关于 Android 中的启动模式的问题
- swift - 在 swift 中,有没有办法只在 for 循环中检查数组的一部分(具有设定的起点和终点)
- lwm2m - Lwm2m protocol: is BootStrap server mandatory?
- node.js - Getting error while adding record into mongodb using mongoose and Node.js
- python - Converting list of milliseconds with NaN values to date in python
- html - why is input button's size different from css style?
- javascript - How can I add href to image source in javascript?
- r - How to set up start date in time series in with hourly data
- javascript - 通过 AJAX 向 MVC 控制器发送字符串
- java - 是否可以不通过文件名而是通过其内容(字符串值)来解析 xml?