0
Bold
の最後の行はどのようにしてfpdf
にできますか?太字表の最後の行
は、ここに私のコードです
foreach ($data as $row) {
$cnt = 0;
foreach ($row as $col) {
if($cnt < 1){
$this->Cell(9,5,$col,1,0,'C');
} elseif ($cnt < 2) {
$this->Cell(18,5,$col,1,0,'C');
} else {
$this->Cell(18,5, $col, 1, 0,'R');
}
$cnt++;
}
$this->Ln();
}
}
更新されたコード:最後の行に到達するまでの行を追加しました条件。
foreach ($data as $row) {
$cnt = 0;
if ($currentRow === $totalRows) {
$this->SetFont('Arial','B');
foreach ($row as $col) {
if($cnt < 1){
$this->Cell(9,5,$col,1,0,'C');
} elseif ($cnt < 2) {
$this->Cell(18,5,$col,1,0,'C');
} else {
$this->Cell(18,5, $col, 1, 0,'R');
}
$cnt++;
}
} else {
$this->SetFont('Arial');
foreach ($row as $col) {
if($cnt < 1){
$this->Cell(9,5,$col,1,0,'C');
} elseif ($cnt < 2) {
$this->Cell(18,5,$col,1,0,'C');
} else {
$this->Cell(18,5, $col, 1, 0,'R');
}
$cnt++;
}
}
$currentRow++;
$this->Ln();
}
上記のサンプルコードでは、私の目標は、現在処理された行が最後のものである場合だけで、あなたはその後、count()行と確認することができ、最後の行に太字
こんにちは!上記のコードを見てください。更新されたコードを作成しようとしましたが、最後の行は '太字 'になりませんでした –
nevermid私はそれを修正しました –