sections.txt
3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
Sections
************
Sections margins and paper width and height can be specified in the same way like for the RTF document. Sections margin and paper width/height will overwrite RTF document margins and paper width/heigth.
.. note::
See *Document settings* > :ref:`doc-settings_page-margins` and *Document settings* > :ref:`doc-settings_page-size`.
Section columns
===============
Section text can be spreaded over columns (all having the same width):
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
// text will spreaded over 3 columns
$section->setNumberOfColumns(3);
Another way to define section columns with particular column widths:
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
// text will spreaded over 3 columns (widths are: 1cm, 2cm, and 3cm)
$section->setColumnWidths(array(1, 2, 3));
Separate your section columns with a line, if you like to:
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
// text will spreaded over 3 columns (widths are: 1cm, 2cm, and 3cm)
$section->setColumnWidths(array(1, 2, 3));
// line between section columns
$section->setLineBetweenColumns();
$section->writeText('Lorem ipsum');
There is also the posibility to add space between the columns:
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
// text will spreaded over 3 columns (widths are: 1cm, 2cm, and 3cm)
$section->setColumnWidths(array(1, 2, 3));
// 0.2cm of space between section columns
$section->setSpaceBetweenColumns(0.2);
$section->writeText('Lorem ipsum');
Page breaks
================
Explizit page break:
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
$section->writeText('Lorem ipsum');
// insert a page break
$section->insertPageBreak();
$section->writeText('Text on the next page');
To prevent a page break, if possible, you can do the following:
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
$section->writeText('Lorem ipsum');
// prevent page break
$section->setNoBreak();
$section->writeText('Text on the next page');
Hyperlinks
===================
To add a hyperlink:
.. code-block:: php
<?php
// some bootstraping here
$section = $rtf->addSection();
$section->writeText('Lorem ipsum: ');
$section->writeHyperLink('http://lipsum.lipsum.com/', 'Lorem ipsum');
Borders
==============
.. code-block:: php
<?php
// some bootstraping here
$border = new PHPRtfLite_Border(
$rtf, // PHPRtfLite instance
new PHPRtfLite_Border_Format(2, '#00FF00'), // left border: 2pt, green color
new PHPRtfLite_Border_Format(1, '#FFFF00'), // top border: 1pt, yellow color
new PHPRtfLite_Border_Format(2, '#FF0000'), // right border: 2pt, red color
new PHPRtfLite_Border_Format(1, '#0000FF') // bottom border: 1pt, blue color
);
$section = $rtf->addSection();
// set section border
$section->setBorder($border);
// set one border format for top, left, right, and bottom
$section->setBorders(new PHPRtfLite_Border_Format(2, '#00FF00'));
Read more about creating borders here: :ref:`borders`.