【问题标题】:Cell is not placed beside the Multicell单元格未放置在多单元格旁边
【发布时间】:2023-04-02 21:01:01
【问题描述】:

我正在使用 php 中的 fpdf 创建 pdf 格式的发票。我的要求是使用 multicell() 创建一个评论框, 并且 在 cmets 旁边,我想使用 cell() 显示账单总额。但在输出中,单元格显示在多单元格下方,而不是放在多单元格旁边

我的代码是:

$pdf->SetFillColor(204,204,204);        //for filling grey color
$pdf->cell(105,5,'Comments',1,1,'',true);  //header of the comment box
$pdf->MultiCell(105,30,'abcd',1,'');     //content of the comment box
$pdf->cell(5,5,'Grand Total',1,1,'C');   //show grand total of the bill

我说清楚了吗?如果不评论,我会描述。

【问题讨论】:

    标签: php fpdf


    【解决方案1】:

    您必须像这样为下一个单元格设置 X 坐标:-

    $current_y = $pdf->GetY();
    $current_x = $pdf->GetX();
    $pdf->MultiCell(105,5,'value',1,'T', false,'T');
    $pdf->SetXY($current_x + 100, $current_y);
    <next-cell>
    

    你会在 MultiCell 之后得到下一个单元格。希望它对你有用...

    【讨论】:

      猜你喜欢
      • 2020-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-04
      • 1970-01-01
      • 2017-02-22
      • 2021-06-17
      • 1970-01-01
      相关资源
      最近更新 更多