使用 FPDF 在单元格中进行文本换行? [英] Make text wrap in a cell with FPDF?

查看:65
本文介绍了使用 FPDF 在单元格中进行文本换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在当我使用带有文本的单元格时,它都停留在一行上.我知道我可以使用 write 函数,但我希望能够指定高度和宽度.

Right now when I use a cell with text, it all stays on one line. I know I could use the write function, but I want to be able to specify the height and width.

这就是我现在所拥有的,但正如我所说,文本不会换行以保持尺寸:

This is what I have now, but as I said the text does not wrap to stay in the dimensions:

$pdf->Cell( 200, 40, $reportSubtitle, 1, 1 );

推荐答案

Text Wrap:

MultiCell 用于打印多行文本.除了lnlink 之外,它具有与Cell 相同的属性.

Text Wrap:

The MultiCell is used for print text with multiple lines. It has the same atributes of Cell except for ln and link.

$pdf->MultiCell( 200, 40, $reportSubtitle, 1);


行高:

multiCell 的作用是将给定的文本展开到多个单元格中,这意味着第二个参数定义了每行(单个单元格)的高度,而不是所有单元格的高度(统称).


Line Height:

What multiCell does is to spread the given text into multiple cells, this means that the second parameter defines the height of each line (individual cell) and not the height of all cells (collectively).

MultiCell(float w, float h, string txt [, 混合边框[, string align [, boolean fill]]])

MultiCell(float w, float h, string txt [, mixed border [, string align [, boolean fill]]])

您可以在此处阅读完整文档.

You can read the full documentation here.

这篇关于使用 FPDF 在单元格中进行文本换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆