• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

fpdf 的cell 中文自动换行问题

php 搞代码 4年前 (2022-01-23) 18次浏览 已收录 0个评论
文章目录[隐藏]

如题

cell 里面的中文不能自动换行是为啥?怎么设置

write 可以换行,但是没有边框
MultiCell 也可以,但是不能生成表格,一个单元格就占了一行,

下载了chinese.php

也不能结局问题,哪位帮忙看看?

回复讨论(解决方案)

你最好贴出测试代码
fpdf 偏于底层,很多东西都是要自己干预的

require ‘./fpdf17/c

……本2文来源gaodai.ma#com搞##代!^码@网3

搞代gaodaima码hinese.php’;

$pdf=new PDF_Chinese();
$pdf->AddPage();
$pdf->AddGBFont();
$pdf->SetFont(‘GB’,”, 20);
$txt=”helloworldhelloworldhelloworl\n ln dhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld”;

$txt=htmlspecialchars($txt); //转换HTML关键字符
$txt=nl2br($txt);

$txt= iconv(‘utf-8’, ‘gb2312’, $txt);

//$pdf->Write(10,$txt);

$pdf->Cell (80,20,$txt,1,1,’C’);
$pdf->Output(“test.pdf”,’D’);

$y = $p->gety();
$x = $p->getx();
$p->setfont(‘text’, ”, 12);
$p->MultiCell(60,40,’中文单元格内容’,1,’C’);
$p->setxy($x+60,$y);
$p->MultiCell(60,40,’中文单元格内容’,1,’C’);

为啥 我这个包里的 multiCell 不支持 多列呢,一个multiCell 就占一行。 而且 字体也没有text 这项呢

要不把你的包发给我一份,[email protected]谢谢

我也遇到类似的问题,请大神


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:fpdf 的cell 中文自动换行问题

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址