Link to home
Create AccountLog in
Avatar of tonelm54

asked on

FPDF MultiCell wrapping issue

I have created a PDF report using FPDF which worked great, until I had to wrap text in the cells. I read an article saying replace cell with MultiCell which compiles, but each cell now goes underneath each other instead of next to each other.

Ive had a look at and cant seem to find out what Ive done wrong, Ive done some searches and again cant find anything wrong.

If anyones had any experience with this, PLEASE HELP :-S

Thank you
class PDF extends FPDF

function Header()
    $this->Cell(30,10,'Title - BETA',1,0,'C');
function Footer()
    $this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');

//Load data
function LoadTestData()
    for ( $counter = 0; $counter <= 100; $counter ++) {
        $data[]=array('Col1Value', 'Col2', 'Col3', 120);

    return $data;

function FancyTable($header,$data)
    //Colors, line width and bold font

    //Color and font restoration

    foreach($data as $row)
        $this->MultiCell($w[0],6,$row[0],0 ,'L',$fill);

        $this->MultiCell($w[1],6,$row[1],0 ,'L',$fill);

        $this->MultiCell($w[2],6,$row[2],0 ,'L',$fill);

        $this->MultiCell($w[3],6,$row[3],0 ,'L',$fill);


$pdf=new PDF();
//Column titles
$header=array('Country','Capital','Area (sq km)','Pop.');

//Data loading


Open in new window

Avatar of Lukasz Chmielewski
Lukasz Chmielewski
Flag of Poland image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account