Maison > Questions et réponses > le corps du texte
Je suis nouveau sur fpdf cell et multicell et j'ai besoin d'aide avec mon code. Ci-dessous le code que j'ai écrit :
$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);
Je veux que ça ressemble à ceci :
P粉7528260082023-09-10 13:45:29
Je recommande fortement d'utiliser plus de variables. Votre code pourrait ressembler à ceci :
// 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);
Cependant, cela ne peut pasrésoudre votre problème. Vous allez passer un mauvais moment car vous avez besoin de :
Toutes les autres bordures doivent être spécifiquement « L », « R » ou « LR ». Vous devez dessiner la bordure supérieure, la bordure inférieure (parfois L ou R) avec un rectangle.
Il y a beaucoup de code, donc si vous avez un tel code, je vous aiderai davantage :)