我正在创建一个发票申请并使用fpdf和https://github.com/farjadtahir/pdf-invoicr pdf-invoicr类。它的工作正常,但现在我在数据库中有多行内容,如地址,当我从表格中保存textarea内容时,它将以 br 标签保存,
nl2br(htmlentities($address, ENT_QUOTES, 'UTF-8'));
当它传递到fpdf 单元格属性时,它会显示br标签,我使用
str_ireplace('<br />', "\r\n", $address);
即使它没有在新行显示,只需用空格替换br。有没有办法在单元格
中的多行打印值foreach($this->items as $item)
{
$cHeight = $cellHeight;
$this->SetFont($this->font,'b',8);
$this->SetTextColor(50,50,50);
$cbgcolor = explode(",",$item['cbgcolor']);
$this->SetFillColor($cbgcolor[0],$cbgcolor[1],$cbgcolor[2]);
$this->Cell(1,$cHeight,'',0,0,'L',1);
$x = $this->GetX();
$this->Cell($this->firstColumnWidth,$cHeight,iconv("UTF-8", "ISO-8859-1",$item['item']),0,0,'L',1);
$this->SetTextColor(50,50,50);
$this->SetFont($this->font,'',8);
$this->Cell($this->columnSpacing,$cHeight,'',0,0,'L',0);
$this->Cell($this->secondColumnWidth,$cHeight,$item['quantity'],0,0,'L',1);
$this->Cell($this->columnSpacing,$cHeight,'',0,0,'L',0);
$this->Cell($this->priceColumnWidth,$cHeight,iconv('UTF-8', 'windows-1252', $this->currency.' '.number_format($item['price'],2,$this->referenceformat[0],$this->referenceformat[1])),0,0,'C',1);
$this->Cell($this->columnSpacing,$cHeight,'',0,0,'L',0);
$this->Cell($this->priceColumnWidth,$cHeight,iconv('UTF-8', 'windows-1252', $this->currency.' '.number_format($item['total'],2,$this->referenceformat[0],$this->referenceformat[1])),0,0,'C',1);
$this->Ln();
$this->Ln($this->columnSpacing);
}
这是我的身体... $ item ['quantity'] 有多行内容。我将值打印为table.so当我在一列中使用multicell时,布局正在改变,看起来不太好。