问题描述
我已经四处搜寻,发现这个问题非常普遍,但是我似乎找不到正确和直接的答案.我正在使用FPDF,并且我想使用MultiCell()生成表,因为我需要它的换行属性.尝试使用Cell(),但无法读取换行符.
I've googled around and found this question very common but I can't seem to find a proper and direct answer. I'm using FPDF and I want to generate tables using MultiCell() since I need the line break property of it. Tried Cell() but it can't read the line break.
$col1="PILOT REMARKS\n\n";
$pdf->MultiCell(189, 10, $col1, 1, 1);
$col2="Pilot's Name and Signature\n".$name;
$pdf->MultiCell(63, 10, $col2, 1);
$pdf->Ln(0);
$col3="Date Prepared\n".$date;
$pdf->MultiCell(63, 10, $col3, 1);
但是我无法正确生成它,因为MultiCell()会堆叠结果.如何以最简单的方式使MultiCell()彼此相邻打印?
But I can't generate it properly 'cause MultiCell() stacks the result. How can I achieve having MultiCell() printed adjacently with each other in a most simple and easy way?
找到了这个类似的问题,但没有提供明确的答案.任何帮助将不胜感激.提前致谢.
Found this similar question but it doesn't provide a clear answer. Any help will be appreciated. Thanks in advance.
推荐答案
尝试存储X和Y坐标,然后在写入后进行设置
Try storing the X and Y co-ordinates and then setting them after the write
$x = $pdf->GetX();
$y = $pdf->GetY();
$col1="PILOT REMARKS\n\n";
$pdf->MultiCell(189, 10, $col1, 1, 1);
$pdf->SetXY($x + 189, $y);
$col2="Pilot's Name and Signature\n".$name;
$pdf->MultiCell(63, 10, $col2, 1);
$pdf->Ln(0);
$col3="Date Prepared\n".$date;
$pdf->MultiCell(63, 10, $col3, 1);
这篇关于FPDF相邻打印MultiCell()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!