php - FPDF table content overlapping the cell -
i want create work dynamic table. because knew how many cells be, kind of because content put cell different length. have used code posted of fpdf site:
require('fpdf/fpdf.php'); class pdf extends fpdf{ function basictable($header, $data) { // header foreach($header $col) $this->cell(40,7,$col,1); $this->ln(); // data foreach($data $row) { foreach($row $col) $this->cell(40,6,$col,1); $this->ln(); } } } and right if put table values:
$header = array('country', 'capital', 'area (sq km)', 'pop. (thousands)'); $data = array(array('a','a','a','a'), array('a','a','a','a'), array('a','a','a','a'), array('a','a','a','a')); $pdf->sety(45); $pdf->basictable($header,$data); everything ok. when want change 'a' more complex, sentence made of few words, text 'leaving' cell , start overlap next cell.
is there way in fpdf autofit cell?
you have use fpdf::multicell() method, used display multiline content.
in multicell, text wrap , won't have problem.
you @ abstraction code on fpdf pdml, or html2fpdf, or maybe tcpdf stated before don't know one.
good luck project.
Comments
Post a Comment