[英]php-pdf -table creation
我正在嘗試使用fpdf創建一個表,但表的輸入量很大,因此它無法放入一個單元格,而且我不知道如何將數據推入下一行而不扭曲表結構。
我嘗試使用多電池到..這是行不通的。
我用了這段代碼
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');
}
誰能幫我這個?
我建議您使用此庫http://www.mpdf1.com/mpdf/ 。 它允許將html + css轉換為pdf文件。 它基於fpdf。 我用它來生成大約1000頁的pdf文件。 太棒了。
我購物會有所幫助。 我不-對不起。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.