PHP | FPDF:Space 第 5 和第 6 个单元格之间

PHP | FPDF : Space between 5th and 6th cell

我在生成这份报告时遇到了麻烦..

我的目标是这样的

可是我只有这个

我希望第 5 和第 6 个单元格之间有一个 space..

到目前为止,这是我的代码:

$pdf = new PDF('L', 'mm', array(215.9, 330.2));
    $pdf->AliasNbPages();
    $pdf->AddPage();
    $pdf->SetFont('Arial','',11);
    $pdf->Cell(132);
    $pdf->Cell(45,15,'Teacher'."'s ".'Table',1,'','C');
    $pdf->Ln(25);
    while($row = mysql_fetch_array($sqlresult)){

        if($pdf->GetX() < 290){
            $pdf->SetFont('Arial','',10);
            $pdf->Cell(30,15,$row['stud_fname'].", ".$row['stud_lname'],1,'','C');
        }else{
            $pdf->Ln(20);
        }

    }
    $pdf->Output();

任何想法将不胜感激,提前致谢:)

计数单元格并在第 5 个和第 6 个之间创建一个 'invisible' 个单元格。

编辑: 我认为你当前的代码是错误的,当 $pdf->GetX() > 290 你正在创建一个新行但也跳过了 mysql 结果(你不写它)。我已经用我认为正确的方式更新了我的答案。

$thisCell=1;
while($row = mysql_fetch_array($sqlresult)){
    if($pdf->GetX() >= 290){
        $pdf->Ln(20);
        $thisCell=1;
    }
    $pdf->SetFont('Arial','',10);
    $pdf->Cell(30,15,$row['stud_fname'].", ".$row['stud_lname'],1,'','C');
    if ($thisCell==5)
        $pdf->Cell(10,15,'',0); //cell without borders
    $thisCell++;
}