我是 fpdf cell 和 multicell 的新手,我的程式碼需要幫助。下面是我寫的程式碼:
$pdf->Cell(60, 6, 'MAILING ADDRESS', 'L,R', 0); $pdf->Multicell(65, 5, $puchaser1[0]["address"], 1); $pdf->Cell(60, 11, $puchaser2[0]["address"], 1); $pdf->Cell(60, 8, 'PHONE NUMBER', 1, 0); $pdf->Cell(65, 8, $puchaser1[0]["contact_no"], 1, 0); $pdf->Cell(65, 8, $puchaser2[0]["contact_no"], 1, 1);
我想讓它看起來像這樣:
#P粉7528260082023-09-10 13:45:29
我強烈建議使用更多變數。您的程式碼可能如下所示:
// Height is different in multicell, this stands for lineheight and should be the same as other cells :) // I would advise you to go for, SMALL_CELL and BIG_CELL if you want to differentiate $WIDTH_CELL = 60; $HEIGHT_CELL = 5; // Most of the time, you want to border all so let's put this in a variable as well // Not in your case though, but more on that below this :) $BORDER = 1; $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, 'MAILING ADDRESS', $border, 0); $pdf->Multicell($WIDTH_CELL, $HEIGHT_CELL, $puchaser1[0]["address"], $border); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser2[0]["address"], $border); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, 'PHONE NUMBER', 1, 0); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser1[0]["contact_no"], $border, 0); $pdf->Cell($WIDTH_CELL, $HEIGHT_CELL, $puchaser2[0]["contact_no"], $border, 1);
但是,這不能解決您的問題。你將會度過一段糟糕的時光,因為你需要:
所有其他邊框應具體為「L」、「R」或「LR」。您必須用矩形繪製頂部邊框、底部(有時是 L 或 R)邊框。
程式碼很多,所以如果您有這樣的程式碼,我會進一步幫助您:)