2012-03-06 8 views
0

私はfpdf でテーブルを作成しようとしていますが、私のテーブルの入力が非常に大きいので、1つのセルに収まらないので、そのデータを歪まずに次のラインにプッシュする方法はわかりません。テーブル構造。php-pdf -tableの作成

マルチセルを使ってみましたが、うまくいきませんでした。

私はこのコード

function table_2($header,$data) 

{ 
    // Colors, line width and bold font 
    $this->SetFillColor(255,0,0); 
    $this->SetTextColor(255); 
    $this->SetDrawColor(128,0,0); 
    $this->SetLineWidth(.3); 
    $this->SetFont('','B',5); 
    // Header 
    $w = array(8, 90, 90); 
    for($i=0;$i<count($header);$i++) 
     $this->Cell($w[$i],7,$header[$i],1,0,'C',true); 
    $this->Ln(); 
    // Color and font restoration 
    $this->SetFillColor(224,235,255); 
    $this->SetTextColor(0); 
    $this->SetFont(''); 
    // Data 
    $fill = false; 
    foreach($data as $row) 
    { 
     $this->Cell($w[0],6,$row[0],1,0,'L',$fill); 
     $this->Cell($w[1],6,$row[1],1,0,'J',$fill); 
     $this->Cell($w[1],6,$row[2],1,0,'J',$fill); 
     //$this->Cell($w[2],6,number_format($row[2]),'LR',0,'R',$fill); 
     //$this->Cell($w[3],6,number_format($row[3]),'LR',0,'R',$fill); 
     $this->Ln(); 
     $fill = !$fill; 
    } 
    // Closing line 
    $this->Cell(array_sum($w),0,'','T'); 
} 

を使用誰もがこれで私を助けることができますか?

答えて

1

このライブラリを使用することをお勧めしますhttp://www.mpdf1.com/mpdf/。それは、HTML + CSSをPDFファイルに変換することができます。それはfpdfに基づいています。私はそれを使って約1000ページのpdfファイルを生成しました。すばらしい。

私は役に立つでしょう。私は - 申し訳ありません。

関連する問題