2017-05-15 2 views
3

I-Code folgende schrieb mit Multizellen eine Tabelle erstellenSo erstellen FPDF Multizellen-Tabelle

$this->Cell(25, 25, "SR.No.", 'LTRB', 0, 'L', true); 
    $this->Cell(60, 25, "CHALLAN", 'LTRB', 0, 'L', true); 
    $this->Cell(300, 25, "JOB NAME", 'LTRB', 0, 'L', true); 
    $this->Cell(60, 25, "QTY.", 'LTRB', 0, 'L', true); 
    $this->Cell(60, 25, "RATE", 'LTRB', 0, 'L', true); 
    $this->Cell(90, 25, "AMOUNT", 'LTRB', 1, 'C', true); 
    $i=1; 
    while($row = mysql_fetch_array($result)) 
    { 
    $x = $this->x; 
    $y = $this->y; 
    $push_right = 0; 
    $this->MultiCell($w = 25,25,$i,1,'C',0); 
    $push_right += $w; 
    $this->SetXY($x + $push_right, $y); 
    $this->MultiCell($w = 60,25,$row[3],1,'C',0); 
    $push_right += $w; 
    $this->SetXY($x + $push_right, $y); 
    $this->MultiCell($w = 300,25,$row[2],1,'L',0); 
    $push_right += $w; 
    $this->SetXY($x + $push_right, $y); 
    $this->MultiCell($w = 60,25,$row[4],1,'L',0); 
    $push_right += $w; 
    $this->SetXY($x + $push_right, $y); 
    $this->MultiCell($w = 60,25,$row[5],1,'L',0); 
    $push_right += $w; 
    $this->SetXY($x + $push_right, $y); 
    $this->MultiCell($w=90,25,$row[6],1,'C',1); 
    $this->Ln(); 
    $i++; 
    } 

Mein Code diesen Ausgang enter image description here

Bu zu erzeugen, die nicht ausrichten i Raum zu entfernen, von beiden Reihen wollen und gleiche Höhe jeder Spalte versuchte viele Zeit, aber nicht gelöst.

Antwort

0

Sie haben Multicell verwendet. Multicell Höhe ist nach Linie, nicht box.And Höhe der Zelle ist entsprechend Box. Daher wurde Text in 2 Zeilen und Höhe zu 50px (25 * 2) und verbleibende Zelle ist Höhe 25px. Verwenden Sie eine Zelle mit einer Höhe von 50px (in Ihrem Fall) anstelle von multicell, wenn der Inhalt statisch ist, oder verwenden Sie multicell, wenn der Inhalt dynamisch ist, und berechnen Sie die Höhe entsprechend. Zum Beispiel: - Deine Boxhöhe wird 50px. Also für die restlichen multicell, Höhe auf 50px einstellen.