How do you make a table like this with FPDF using PHP?

前端 未结 3 1544
执念已碎
执念已碎 2020-12-16 22:35

How do you make a table like this with FPDF using PHP?

I can\'t seem to figure out how to do this with $this->Cell.

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-16 23:38

    FPDF does not recognize rowspan or colspan. Here is a workaround that you can try, using empty cells and the border attribute for Cell.

    $pdf->Cell(40,5,' ','LTR',0,'L',0);   // empty cell with left,top, and right borders
    $pdf->Cell(50,5,'Words Here',1,0,'L',0);
    $pdf->Cell(50,5,'Words Here',1,0,'L',0);
    $pdf->Cell(40,5,'Words Here','LR',1,'C',0);  // cell with left and right borders
    $pdf->Cell(50,5,'[ x ] abc',1,0,'L',0);
    $pdf->Cell(50,5,'[ x ] checkbox1',1,0,'L',0);
    $pdf->Cell(40,5,'','LBR',1,'L',0);   // empty cell with left,bottom, and right borders
    $pdf->Cell(50,5,'[ x ] def',1,0,'L',0);
    $pdf->Cell(50,5,'[ x ] checkbox2',1,0,'L',0);
    

    and the result would be - fpdf table example

提交回复
热议问题