问题描述
我有一个导出为 pdf 的表格数据。我使用 Fpdf 和 Codeigniter。 首先我的 fpdf 运行良好,我可以导出它。
我需要把这个表变成 2 列,很难找到关于它的文档 但我可以让它喜欢这个
这是我的代码
foreach ($lists as $key => $value)
{
$c++;
/*% total data per page,kenapa %total == 1 karena akan di addPage Bukan Ketika saat mencapai total,tapi total + 1*/
if ($c%99999 == 1 || $c == 1)
{
$pdf->AddPage('L','A4');
$pdf->SetDrawColor(209,212,207);
$pdf->SetFont('Arial','B',16);
$pdf->SetFont('Arial',14);
$pdf->Cell(280,6,'Data Stok Barang Toko',1,'C');
$pdf->Ln();
$pdf->SetFont('Arial','',12);
$pdf->Cell(280,'Mulya Indah','C');
$pdf->SetFont('Arial',12);
$pdf->Cell(40,'Tanggal Cetak','L',FALSE);
$pdf->Cell(130,': '.date('d M Y'),FALSE);
$pdf->Ln();
$pdf->Cell(40,'Halaman',': '.ceil($c/76).' / '.number_format(ceil(sizeof($lists)/76)),FALSE);
$pdf->Ln();
$pdf->Ln();
$pdf->Ln();
$pdf->SetFont('Arial',11);
$pdf->Cell(5,15,0);
$pdf->Cell(15,'ID',0);
$pdf->Cell(100,'Nama Barang',0);
$pdf->Cell(10,'Stok',0);
$pdf->Cell(5,0);
$pdf->Cell(15,1);
$pdf->SetFont('Arial',10);
}
$is_spit = $c %2== 0 ? 1 : 0;
$is_lastrow = $c %2== 0 ? 60 : 50;
$pdf->Cell(5,0);
$pdf->Cell(15,number_format($c),0);
$pdf->Cell(100,$value['nama_barang'],0);
$data =$value['stock_sisa'];
$pdf->CustomTxt($data,$is_spit);//just for background $this->Cell(10,"$num",$row,1);
}
$pdf->Output('I','DataStok_'.date('Ymd').'.pdf');
/*gaperlu return,$pdf->Output == merubah header content ketoke,dadi return dibawah gabakal kebaca*/
}
但我想要这样的
|no|name| |no|name |
|-----------|--------|
| 1| txt| | 6 | txt|
| 2| txt| | 7 | txt|
| 3| txt| | 8 | txt|
| 4| txt| | 9 | txt|
| 5| txt| | 10| txt|
有人可以帮我吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)