Reputation: 165
I am trying to create a table with fpdf but the inputs of my table is quite big so its not fitting in one cell and i dont know how to push that data into next line without distorting the table structure.
I tried using multicell to..which did not work.
i used this code
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');
}
can anyone help me with this?
Upvotes: 0
Views: 3082
Reputation: 4461
I would suggest you to use this lib http://www.mpdf1.com/mpdf/. It allows to convert html+css into pdf file. It is based on fpdf. I used it to generate pdf-file with about 1000 pages. It is awesome.
I shope it will helpfull. I not - sorry.
Upvotes: 1