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

查看:148
本文介绍了使用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 );

推荐答案

文字换行:

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,字符串txt [,混合边框[,字符串align [,布尔值填充]]])

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

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

You can read the full documentation here.

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

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