我已经使用fpdf
库生成了一个 pdf。数据被导出到 pdf 文档我想设置单个列单元格的宽度如何做我知道在这个函数中必须做一些事情来增加宽度
function CalcWidths($width,$align)
{
//Compute the widths of the columns
$TableWidth=0;
foreach($this->aCols as $i=>$col)
{
$w=$col['w'];
if($w==-1)
$w=$width/count($this->aCols);
elseif(substr($w,-1)=='%')
$w=$w/100*$width;
$this->aCols[$i]['w']=$w;
$TableWidth+=$w;
}
if($align=='C')
$this->TableX=max(($this->w-$TableWidth)/2,0);
elseif($align=='R')
$this->TableX=max($this->w-$this->rMargin-$TableWidth,0);
else
$this->TableX=$this->lMargin;
}
什么必须改变
问问题
137 次
1 回答
2
宽度可以像这样分配fpdf,
$options = array('cols' =>
array('Detail1' => array('width'=>100, 'justification' => 'left'),
'Detail2' => array('width'=>400, 'justification' => 'left')
)
);
但是字段值会扩展,然后宽度也会增加。然后像这样使用
$table[] = array(
array("Detail1" => "D1", "Detail2" => wordwrap($x1, 200, "\n", 1)),
array("Detail1" => "D2", "Detail2" => wordwrap($x2, 200, "\n", 1)),
array("Detail1" => "D3", "Detail2" => wordwrap($x3, 200, "\n", 1))
);
于 2010-07-08T05:54:57.240 回答