【发布时间】:2017-04-06 09:44:44
【问题描述】:
我有一个动态 PHP 表,它是通过 FPDF 生成到 PDF 上的。
如何使“名称”列比其他列更宽?
class PDF extends FPDF {
function Header() {
$this->Image('quote-header.png');
$this->Ln(2);
}
function Footer() {
$this->Image('quote-footer.png');
}
function LoadData($file) {
$lines = file($file);
$data = array();
foreach($lines as $line)
$data[] = explode(';', trim($line));
return $data;
}
function BasicTable($header, $data) {
foreach($header as $col)
$this->Cell(40, 7, $col, 1);
$this->Ln();
foreach($data as $row) {
foreach($row as $col)
$this->Cell(40, 6, $col, 1);
$this->Ln();
}
}
}
$header = array('Product Reference', 'Name', '('. $pound_sign .') Price (excl. VAT)', 'Unit');
我确信这是生成表格的唯一代码?
任何帮助都会很棒。这是针对我工作的公司的产品报价系统,如果不解决此列宽问题,我将无法取得进一步进展。
该表由 4 列组成:产品参考、名称、价格和单位。我需要名称列比其他列宽,或者如果可能(自动调整)到产品名称。
【问题讨论】: