简体   繁体   English

如何使 multiCell 中的文本填满整个表格单元格?

[英]How to make text inside multiCell filled the whole table cell?

I need to fill the text inside multiCell我需要在 multiCell 中填充文本

在此处输入图像描述] 1 ] 1

Currently i am using this code.目前我正在使用此代码。

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

I change the first value param into this我将第一个值参数更改为此

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

But the result would be like this但结果会是这样

在此处输入图像描述

While i want the text to fit the red marks part and not making a new line like the first pic did.虽然我希望文本适合红色标记部分,而不是像第一张图片那样换行。

What could go wrong with my code? go 我的代码有什么问题?

Since all indications point to there being escape sequences in your input data I would suggest making a simple change to your code to make sure that there aren't any now or later.由于所有迹象都表明您的输入数据中存在转义序列,因此我建议对您的代码进行简单的更改,以确保现在或以后没有任何转义序列。 Change改变

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

to

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

That change should remove escape characters and replace them with a single space.该更改应删除转义字符并将其替换为单个空格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM