【问题标题】:How to make a table in PHP in FPDF? [closed]如何在 FPDF 中用 PHP 制作表格? [关闭]
【发布时间】:2023-01-20 00:06:56
【问题描述】:

我想知道,我如何制作表格,通过一个框填写数据,然后将其放入 FPDF 中

我已经尝试过在线搜索,但所有方法均无效。

【问题讨论】:

  • 有一个特定于表的官方示例; fpdf.org/en/tutorial/tuto5.htm。如果它和“所有方法”都不起作用,那很可能是你自己的问题,你应该分享你的代码和错误/特定问题以供人们协助。
  • 人们标记并关闭您的问题的原因是因为该论坛要求问题相当具体且经过深思熟虑。您说您在网上查看并且这些方法不起作用的说法没有意义。你发现了什么?你试过什么?你得到了什么错误?

标签: php mysql xampp fpdf


【解决方案1】:
require('fpdf.php');

$pdf = new FPDF();
$pdf->AddPage();

$pdf->SetFont('Arial','B',12);
$pdf->Cell(40,10,'Header 1',1,0,'C');
$pdf->Cell(40,10,'Header 2',1,0,'C');
$pdf->Cell(40,10,'Header 3',1,0,'C');
$pdf->Cell(40,10,'Header 4',1,1,'C');

$pdf->SetFont('Arial','',12);
$pdf->Cell(40,10,'Row 1 Col 1',1,0,'C');
$pdf->Cell(40,10,'Row 1 Col 2',1,0,'C');
$pdf->Cell(40,10,'Row 1 Col 3',1,0,'C');
$pdf->Cell(40,10,'Row 1 Col 4',1,1,'C');

$pdf->Rect(20, 60, 170, 20);
$pdf->SetXY(25, 65);
$pdf->Cell(0, 0, 'Fill in data here');

$pdf->Output();

//or 
// $pdf->Output('F', 'filename.pdf'); // save the pdf as 'filename.pdf' in the server.

【讨论】:

  • 我不知道为什么人们如此讨厌这个答案。如果他们有话要说,他们应该说出来。
  • 正是 AltimusPrime。 @IdkWhatImDoing1212 如果解决了您的问题,请您标记一下。
猜你喜欢
  • 2015-07-07
  • 2012-11-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-26
  • 2023-04-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多