blob: c2d9d1bb7ab7f4f3719da8d85d27e8ee9150a6ea [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5<title>Cell</title>
6<link type="text/css" rel="stylesheet" href="../fpdf.css">
7</head>
8<body>
9<h1>Cell</h1>
10<code>Cell(<b>float</b> w [, <b>float</b> h [, <b>string</b> txt [, <b>mixed</b> border [, <b>int</b> ln [, <b>string</b> align [, <b>boolean</b> fill [, <b>mixed</b> link]]]]]]])</code>
11<h2>Description</h2>
12Prints a cell (rectangular area) with optional borders, background color and character string.
13The upper-left corner of the cell corresponds to the current position. The text can be aligned
14or centered. After the call, the current position moves to the right or to the next line. It is
15possible to put a link on the text.
16<br>
17If automatic page breaking is enabled and the cell goes beyond the limit, a page break is
18done before outputting.
19<h2>Parameters</h2>
20<dl class="param">
21<dt><code>w</code></dt>
22<dd>
23Cell width. If <code>0</code>, the cell extends up to the right margin.
24</dd>
25<dt><code>h</code></dt>
26<dd>
27Cell height.
28Default value: <code>0</code>.
29</dd>
30<dt><code>txt</code></dt>
31<dd>
32String to print.
33Default value: empty string.
34</dd>
35<dt><code>border</code></dt>
36<dd>
37Indicates if borders must be drawn around the cell. The value can be either a number:
38<ul>
39<li><code>0</code>: no border</li>
40<li><code>1</code>: frame</li>
41</ul>
42or a string containing some or all of the following characters (in any order):
43<ul>
44<li><code>L</code>: left</li>
45<li><code>T</code>: top</li>
46<li><code>R</code>: right</li>
47<li><code>B</code>: bottom</li>
48</ul>
49Default value: <code>0</code>.
50</dd>
51<dt><code>ln</code></dt>
52<dd>
53Indicates where the current position should go after the call. Possible values are:
54<ul>
55<li><code>0</code>: to the right</li>
56<li><code>1</code>: to the beginning of the next line</li>
57<li><code>2</code>: below</li>
58</ul>
59Putting <code>1</code> is equivalent to putting <code>0</code> and calling Ln() just after.
60Default value: <code>0</code>.
61</dd>
62<dt><code>align</code></dt>
63<dd>
64Allows to center or align the text. Possible values are:
65<ul>
66<li><code>L</code> or empty string: left align (default value)</li>
67<li><code>C</code>: center</li>
68<li><code>R</code>: right align</li>
69</ul>
70</dd>
71<dt><code>fill</code></dt>
72<dd>
73Indicates if the cell background must be painted (<code>true</code>) or transparent (<code>false</code>).
74Default value: <code>false</code>.
75</dd>
76<dt><code>link</code></dt>
77<dd>
78URL or identifier returned by AddLink().
79</dd>
80</dl>
81<h2>Example</h2>
82<div class="doc-source">
83<pre><code>// Set font
84$pdf-&gt;SetFont('Arial', 'B', 16);
85// Move to 8 cm to the right
86$pdf-&gt;Cell(80);
87// Centered text in a framed 20*10 mm cell and line break
88$pdf-&gt;Cell(20, 10, 'Title', 1, 1, 'C');</code></pre>
89</div>
90<h2>See also</h2>
91<a href="setfont.htm">SetFont</a>,
92<a href="setdrawcolor.htm">SetDrawColor</a>,
93<a href="setfillcolor.htm">SetFillColor</a>,
94<a href="settextcolor.htm">SetTextColor</a>,
95<a href="setlinewidth.htm">SetLineWidth</a>,
96<a href="addlink.htm">AddLink</a>,
97<a href="ln.htm">Ln</a>,
98<a href="multicell.htm">MultiCell</a>,
99<a href="write.htm">Write</a>,
100<a href="setautopagebreak.htm">SetAutoPageBreak</a>
101<hr style="margin-top:1.5em">
102<div style="text-align:center"><a href="index.htm">Index</a></div>
103</body>
104</html>