How to create a multi-series FPDF table

I wrote the following code to create a multicore memory table

$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++;
    }

      

My code generating this output enter image description here

Boo that is not aligned, I want to remove space from both rows and equal height of each column, tried many times but didn't solve.

+3


source to share


1 answer


You have used Multicell. The reusable height fits the string, not the box. The cell height corresponds to the scale. Hence, the text appeared on 2 lines, and the height became 50px (25 * 2), and the remaining cell was 25px high. Use a cell with a height of 50px (in your case) instead of reusable if the content is static or use reusable if the content is dynamic and calculates the height accordingly. For example: your box is 50 pixels high. So for the rest of the set, set the height to 50 pixels.



0


source







All Articles