2015-11-06 21 views
1

我在使用PHP通過ezpdf顯示數據時遇到了問題。描述的內容非常長,因此在導出時將通過紙張。有什麼辦法可以解決這個問題嗎?如何通過PHP與EZPDF從Mysql導出時響應表格

<?php session_start(); 
require 'config.php'; 
require 'class.ezpdf.php'; 
require 'cek/cek_session.php'; 

$sql = mysqli_query($conn, "SELECT * FROM arsip WHERE unitkerja = '$sesen_uk' ORDER BY id_arsip ASC"); 
$i = 1; 
if (mysqli_num_rows($sql) > 0) 
{ 
    while($tampil = mysqli_fetch_array($sql)) 
    { 
    $data[$i] = array ('No'  => $i, 
        'Description'  => $tampil['desc'], 
        'Department'  => $tampil['dpt'], 
        'Location' => $tampil['location'], 
       ); 
      $i++; 
    } 

    $pdf = new Cezpdf('A4','landscape'); 
    $pdf->ezSetCmMargins(1, 3, 3, 3); 
    $pdf->ezText('Report', 17, array('justification' => 'center')); 
    $pdf->ezSetDy(-10); 

    $pdf->ezTable($data, '', '', ''); 
    $pdf->ezSetDy(-50); 

    $pdf->ezStartPageNumbers(799,50, 10, 4); 
    $pdf->ezStream(); 
} 
    else 
    { 
    echo '<script>alert("Belum ada data");location.replace("report.php")</script>'; 
} 
?> 

輸出應該是這樣的:

http://tinypic.com/r/2zyl9xj/9

任何幫助將是巨大的,謝謝。

回答

0

,你可以像下面的選項添加寬度:

$options=array(

     'width'=>550 

     ); 

$pdf->ezTable($data,$cols='',$title='',$options); 

與寬度文本將包梁