@@ -47,14 +47,6 @@ column shows the containers while the rows lists the elements.
47
47
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
48
48
| 19 | Line | v | v | v | v | v | v |
49
49
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
50
- | 20 | Shape | v | v | v | v | v | v |
51
- +-------+-----------------+-----------+----------+----------+---------+------------+------------+
52
- | 21 | Chart | v | - | - | - | - | - |
53
- +-------+-----------------+-----------+----------+----------+---------+------------+------------+
54
- | 22 | Form fields | v | v | v | v | v | v |
55
- +-------+-----------------+-----------+----------+----------+---------+------------+------------+
56
- | 23 | Bookmarks | v | - | - | v | v | - |
57
- +-------+-----------------+-----------+----------+----------+---------+------------+------------+
58
50
59
51
Legend:
60
52
@@ -79,6 +71,9 @@ as follow:
79
71
$section->addText($text, [$fontStyle], [$paragraphStyle]);
80
72
$textrun = $section->addTextRun([$paragraphStyle]);
81
73
74
+ Text styles
75
+ ~~~~~~~~~~~
76
+
82
77
You can use the ``$fontStyle `` and ``$paragraphStyle `` variable to
83
78
define text formatting. There are 2 options to style the inserted text
84
79
elements, i.e. inline style by using array or defined style by adding
@@ -109,6 +104,47 @@ Defined style examples:
109
104
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
110
105
$text = $section->addText('Hello world!', 'pStyle');
111
106
107
+ Font style
108
+ ^^^^^^^^^^
109
+
110
+ Available font styles:
111
+
112
+ - ``name `` Font name, e.g. *Arial *
113
+ - ``size `` Font size, e.g. *20 *, *22 *,
114
+ - ``hint `` Font content type, *default *, *eastAsia *, or *cs *
115
+ - ``bold `` Bold, *true * or *false *
116
+ - ``italic `` Italic, *true * or *false *
117
+ - ``superScript `` Superscript, *true * or *false *
118
+ - ``subScript `` Subscript, *true * or *false *
119
+ - ``underline `` Underline, *dash *, *dotted *, etc.
120
+ - ``strikethrough `` Strikethrough, *true * or *false *
121
+ - ``doubleStrikethrough `` Double strikethrough, *true * or *false *
122
+ - ``color `` Font color, e.g. *FF0000 *
123
+ - ``fgColor `` Font highlight color, e.g. *yellow *, *green *, *blue *
124
+ - ``bgColor `` Font background color, e.g. *FF0000 *
125
+ - ``smallCaps `` Small caps, *true * or *false *
126
+ - ``allCaps `` All caps, *true * or *false *
127
+
128
+ Paragraph style
129
+ ^^^^^^^^^^^^^^^
130
+
131
+ Available paragraph styles:
132
+
133
+ - ``align `` Paragraph alignment, *left *, *right * or *center *
134
+ - ``spaceBefore `` Space before paragraph
135
+ - ``spaceAfter `` Space after paragraph
136
+ - ``indent `` Indent by how much
137
+ - ``hanging `` Hanging by how much
138
+ - ``basedOn `` Parent style
139
+ - ``next `` Style for next paragraph
140
+ - ``widowControl `` Allow first/last line to display on a separate page,
141
+ *true * or *false *
142
+ - ``keepNext `` Keep paragraph with next paragraph, *true * or *false *
143
+ - ``keepLines `` Keep all lines on one page, *true * or *false *
144
+ - ``pageBreakBefore `` Start paragraph on next page, *true * or *false *
145
+ - ``lineHeight `` text line height, e.g. *1.0 *, *1.5 *, ect...
146
+ - ``tabs `` Set of custom tab stops
147
+
112
148
Titles
113
149
~~~~~~
114
150
@@ -131,13 +167,12 @@ You can add Hyperlinks to the document by using the function addLink:
131
167
132
168
.. code-block :: php
133
169
134
- $section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle], [$isInternal] );
170
+ $section->addLink($linkSrc, [$linkName], [$fontStyle], [$paragraphStyle]);
135
171
136
172
- ``$linkSrc `` The URL of the link.
137
173
- ``$linkName `` Placeholder of the URL that appears in the document.
138
174
- ``$fontStyle `` See "Font style" section.
139
175
- ``$paragraphStyle `` See "Paragraph style" section.
140
- - ``$isInternal `` Set to true, if the link points to a bookmark inside the document
141
176
142
177
Preserve texts
143
178
~~~~~~~~~~~~~~
@@ -172,9 +207,9 @@ Page breaks
172
207
There are two ways to insert a page breaks, using the ``addPageBreak ``
173
208
method or using the ``pageBreakBefore `` style of paragraph.
174
209
175
- .. code-block :: php
210
+ :: code-block:: php
176
211
177
- $section->addPageBreak();
212
+ \\ $section->addPageBreak();
178
213
179
214
Lists
180
215
-----
@@ -217,6 +252,23 @@ You can also create your own numbering style by changing the
217
252
$section->addListItem('List Item I.b', 1, null, 'multilevel');
218
253
$section->addListItem('List Item II', 0, null, 'multilevel');
219
254
255
+ Level styles:
256
+
257
+ - ``start `` Starting value
258
+ - ``format `` Numbering format
259
+ bullet\| decimal\| upperRoman\| lowerRoman\| upperLetter\| lowerLetter
260
+ - ``restart `` Restart numbering level symbol
261
+ - ``suffix `` Content between numbering symbol and paragraph text
262
+ tab\| space\| nothing
263
+ - ``text `` Numbering level text e.g. %1 for nonbullet or bullet
264
+ character
265
+ - ``align `` Numbering symbol align left\| center\| right\| both
266
+ - ``left `` See paragraph style
267
+ - ``hanging `` See paragraph style
268
+ - ``tabPos `` See paragraph style
269
+ - ``font `` Font name
270
+ - ``hint `` See font style
271
+
220
272
Tables
221
273
------
222
274
@@ -242,6 +294,34 @@ Table style can be defined with ``addTableStyle``:
242
294
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
243
295
$table = $section->addTable('myTable');
244
296
297
+ Table, row, and cell styles
298
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
299
+
300
+ Table styles:
301
+
302
+ - ``width `` Table width in percent
303
+ - ``bgColor `` Background color, e.g. '9966CC'
304
+ - ``border(Top|Right|Bottom|Left)Size `` Border size in twips
305
+ - ``border(Top|Right|Bottom|Left)Color `` Border color, e.g. '9966CC'
306
+ - ``cellMargin(Top|Right|Bottom|Left) `` Cell margin in twips
307
+
308
+ Row styles:
309
+
310
+ - ``tblHeader `` Repeat table row on every new page, *true * or *false *
311
+ - ``cantSplit `` Table row cannot break across pages, *true * or *false *
312
+ - ``exactHeight `` Row height is exact or at least
313
+
314
+ Cell styles:
315
+
316
+ - ``width `` Cell width in twips
317
+ - ``valign `` Vertical alignment, *top *, *center *, *both *, *bottom *
318
+ - ``textDirection `` Direction of text
319
+ - ``bgColor `` Background color, e.g. '9966CC'
320
+ - ``border(Top|Right|Bottom|Left)Size `` Border size in twips
321
+ - ``border(Top|Right|Bottom|Left)Color `` Border color, e.g. '9966CC'
322
+ - ``gridSpan `` Number of columns spanned
323
+ - ``vMerge `` *restart * or *continue *
324
+
245
325
Cell span
246
326
~~~~~~~~~
247
327
@@ -288,6 +368,19 @@ Examples:
288
368
$textrun = $section->addTextRun();
289
369
$textrun->addImage('http://php.net/logo.jpg');
290
370
371
+ Image styles
372
+ ~~~~~~~~~~~~
373
+
374
+ Available image styles:
375
+
376
+ - ``width `` Width in pixels
377
+ - ``height `` Height in pixels
378
+ - ``align `` Image alignment, *left *, *right *, or *center *
379
+ - ``marginTop `` Top margin in inches, can be negative
380
+ - ``marginLeft `` Left margin in inches, can be negative
381
+ - ``wrappingStyle `` Wrapping style, *inline *, *square *, *tight *,
382
+ *behind *, or *infront *
383
+
291
384
Watermarks
292
385
~~~~~~~~~~
293
386
@@ -390,56 +483,30 @@ Checkbox elements can be added to sections or table cells by using
390
483
Textboxes
391
484
---------
392
485
393
- To be completed.
486
+ To be completed
394
487
395
488
Fields
396
489
------
397
490
398
- To be completed.
491
+ To be completed
399
492
400
- Lines
401
- -----
493
+ Line
494
+ ------
402
495
403
496
Line elements can be added to sections by using ``addLine ``.
404
497
405
498
.. code-block :: php
406
499
407
- $linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => '#b2a68b' );
500
+ $linestyle = array('weight' => 1, 'width' => 100, 'height' => 0, 'color' => 635552 );
408
501
$section->addLine($lineStyle)
409
502
410
503
Available line style attributes:
411
504
412
505
- ``weight `` Line width in twips
413
- - ``color `` Defines the color of stroke. The hex value must be introduced with #.
506
+ - ``color `` Defines the color of stroke
414
507
- ``dash `` Line types: dash, rounddot, squaredot, dashdot, longdash, longdashdot, longdashdotdot
415
508
- ``beginArrow `` Start type of arrow: block, open, classic, diamond, oval
416
509
- ``endArrow `` End type of arrow: block, open, classic, diamond, ovel
417
510
- ``width `` Line-object width in pt
418
511
- ``height `` Line-object height in pt
419
512
- ``flip `` Flip the line element: true, false
420
-
421
- Shapes
422
- ------
423
-
424
- To be completed.
425
-
426
- Charts
427
- ------
428
-
429
- To be completed.
430
-
431
- Form fields
432
- -----------
433
-
434
- To be completed.
435
-
436
- Bookmarks
437
- ~~~~~
438
-
439
- You can add Bookmarks to the document by using the function addBookmark:
440
-
441
- .. code-block :: php
442
-
443
- $section->addBookmark($name);
444
-
445
- - ``$name `` The name of the bookmark which can be referenced in the addLink-Function as target. Should obviously be unique throughout the document.
0 commit comments