我想輸出一個使用FPDF
和PHP的表格。使用fpdf輸出表格
我需要的是輸出表標題,我有一個教條(symfony)集合。
我用用writeHTML
方法:
$pdf->writeHTML('<table>','','','','');
$pdf->writeHTML('<tr><th>Tooth Selection</th><th>Requirements</th><th>Shade</th><th>Cost</th></tr>','','','','');
$order_items = $this->order_details->getIncludedItemsOrders();
foreach($order_items as $item)
{
$pdf->writeHTML('<tr><td>Test1</td><td>Test2</td><td>Test3</td><td>test4</td></tr>', '','');
}
$pdf->writeHTML('</table>');
但我得到的錯誤,如:
Notice: Undefined index: cols in
Notice: Undefined variable: cellspacingx in
我這樣做正確的,因爲我無法找到關於輸出多少信息表使用foreach
謝謝
找到http://stackoverflow.com/questions/5261684/tcpdf-printing-table-from-mysql這似乎幫助我 – terrid25