douna6802 2019-07-28 13:22
浏览 145

如何在tcpdf中创建垂直侧标题表

when i use this method, the heading of table is horizontal, not the vertical heading.

  $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;  

i want the result of the pdf is , the table heading is at the vertical and at the left side, not horizontal.

 <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>  

Below code is merge the value and the table heading

  <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');

I need a result like this,

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 用matlab 设计一个不动点迭代法求解非线性方程组的代码
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试