如何使 multiCell 内的文本填充整个表格单元格?

问题描述

我需要在 multiCell 中填充文本

enter image description here

]1

目前我正在使用此代码

$this->SetX($this->xKiri + $widthBoxNomor + ($widthDalam / 2) + 3);
$this->Cell(15,3,'Address');
$this->MultiCell(0,strtoupper($this->data_header [0] ['alamat_importir']),1,"J");
$this->Ln(4);

我把第一个值参数改成这个

$this->MultiCell(10,"J");

但结果会是这样

enter image description here

虽然我希望文本适合红色标记部分,而不是像第一张图片那样创建新行。

我的代码可能有什么问题?

解决方法

由于所有迹象都表明您的输入数据中存在转义序列,我建议对您的代码进行简单的更改,以确保现在或以后都没有。改变

$this->MultiCell(0,3,strtoupper($this->data_header [0] ['alamat_importir']),1,"J");

$this->MultiCell(0,strtoupper(str_replace(["\t","\r","\n"],' ',$this->data_header [0] ['alamat_importir'])),"J");

该更改应删除转义字符并将其替换为单个空格。