Heim > Fragen und Antworten > Hauptteil
Ich bin neu bei fpdf cell und multicell und benötige Hilfe bei meinem Code. Unten ist der Code, den ich geschrieben habe:
$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);
Ich möchte, dass es so aussieht:
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)边框。
代码很多,所以如果您有这样的代码,我会进一步帮助您:)