@@ -25,36 +25,53 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
25
25
$section = $phpWord->addSection();
26
26
// Adding Text element to the Section having font styled by default...
27
27
$section->addText(
28
- htmlspecialchars('"Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning." (Albert Einstein)')
28
+ htmlspecialchars(
29
+ '"Learn from yesterday, live for today, hope for tomorrow. '
30
+ . 'The important thing is not to stop questioning." '
31
+ . '(Albert Einstein)'
32
+ )
29
33
);
30
34
31
35
/*
32
- * Note: it is possible to customize font style of the Text element you add in three ways:
36
+ * Note: it's possible to customize font style of the Text element you add in three ways:
33
37
* - inline;
34
38
* - using named font style (new font style object will be implicitly created);
35
39
* - using explicitly created font style object.
36
40
*/
37
41
38
- // Adding Text element having font customized inline...
42
+ // Adding Text element with font customized inline...
39
43
$section->addText(
40
- htmlspecialchars('"Great achievement is usually born of great sacrifice, and is never the result of selfishness." (Napoleon Hill)'),
44
+ htmlspecialchars(
45
+ '"Great achievement is usually born of great sacrifice, '
46
+ . 'and is never the result of selfishness." '
47
+ . '(Napoleon Hill)'
48
+ ),
41
49
array('name' => 'Tahoma', 'size' => 10)
42
50
);
43
51
44
- // Adding Text element having font customized using named font style...
52
+ // Adding Text element with font customized using named font style...
45
53
$fontStyleName = 'oneUserDefinedStyle';
46
- $phpWord->addFontStyle($fontStyleName, array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true));
54
+ $phpWord->addFontStyle(
55
+ $fontStyleName,
56
+ array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
57
+ );
47
58
$section->addText(
48
- htmlspecialchars('"The greatest accomplishment is not in never falling, but in rising again after you fall." (Vince Lombardi)'),
59
+ htmlspecialchars(
60
+ '"The greatest accomplishment is not in never falling, '
61
+ . 'but in rising again after you fall." '
62
+ . '(Vince Lombardi)'
63
+ ),
49
64
$fontStyleName
50
65
);
51
66
52
- // Adding Text element having font customized using explicitly created font style object...
67
+ // Adding Text element with font customized using explicitly created font style object...
53
68
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
54
69
$fontStyle->setBold(true);
55
70
$fontStyle->setName('Tahoma');
56
71
$fontStyle->setSize(13);
57
- $myTextElement = $section->addText(htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)'));
72
+ $myTextElement = $section->addText(
73
+ htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
74
+ );
58
75
$myTextElement->setFontStyle($fontStyle);
59
76
60
77
// Saving the document as OOXML file...
@@ -69,8 +86,8 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
69
86
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
70
87
$objWriter->save('helloWorld.html');
71
88
72
- /* Note: RTF was skipped here , because the format is not XML-based and requires a bit different example. */
73
- /* Note: PDF was skipped here , because we use "HTML-to-PDF" approach to create PDF documents. */
89
+ /* Note: we skip RTF , because it's not XML-based and requires a different example. */
90
+ /* Note: we skip PDF , because "HTML-to-PDF" approach is used to create PDF documents. */
74
91
75
92
Settings
76
93
--------
0 commit comments