Skip to content

Commit 41983e0

Browse files
author
Roman Syroeshko
committed
Merge pull request #356 from GMTA/develop
1 parent fa7f2cd commit 41983e0

File tree

3 files changed

+61
-27
lines changed

3 files changed

+61
-27
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ $section->addText(
112112
* - using explicitly created font style object.
113113
*/
114114

115-
// Adding Text element having font customized inline...
115+
// Adding Text element with font customized inline...
116116
$section->addText(
117117
htmlspecialchars(
118118
'"Great achievement is usually born of great sacrifice, '
@@ -122,7 +122,7 @@ $section->addText(
122122
array('name' => 'Tahoma', 'size' => 10)
123123
);
124124

125-
// Adding Text element having font customized using named font style...
125+
// Adding Text element with font customized using named font style...
126126
$fontStyleName = 'oneUserDefinedStyle';
127127
$phpWord->addFontStyle(
128128
$fontStyleName,
@@ -137,7 +137,7 @@ $section->addText(
137137
$fontStyleName
138138
);
139139

140-
// Adding Text element having font customized using explicitly created font style object...
140+
// Adding Text element with font customized using explicitly created font style object...
141141
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
142142
$fontStyle->setBold(true);
143143
$fontStyle->setName('Tahoma');
@@ -159,8 +159,8 @@ $objWriter->save('helloWorld.odt');
159159
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
160160
$objWriter->save('helloWorld.html');
161161

162-
/* Note: RTF was skipped, because it's not XML-based and requires a different example. */
163-
/* Note: PDF was skipped, because we use "HTML-to-PDF" approach to create PDF documents. */
162+
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
163+
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
164164
```
165165
:warning: Escape any string you pass to OOXML/ODF/HTML document, otherwise it may get broken.
166166

docs/general.rst

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,53 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
2525
$section = $phpWord->addSection();
2626
// Adding Text element to the Section having font styled by default...
2727
$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+
)
2933
);
3034
3135
/*
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:
3337
* - inline;
3438
* - using named font style (new font style object will be implicitly created);
3539
* - using explicitly created font style object.
3640
*/
3741
38-
// Adding Text element having font customized inline...
42+
// Adding Text element with font customized inline...
3943
$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+
),
4149
array('name' => 'Tahoma', 'size' => 10)
4250
);
4351
44-
// Adding Text element having font customized using named font style...
52+
// Adding Text element with font customized using named font style...
4553
$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+
);
4758
$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+
),
4964
$fontStyleName
5065
);
5166
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...
5368
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
5469
$fontStyle->setBold(true);
5570
$fontStyle->setName('Tahoma');
5671
$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+
);
5875
$myTextElement->setFontStyle($fontStyle);
5976
6077
// Saving the document as OOXML file...
@@ -69,8 +86,8 @@ folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
6986
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
7087
$objWriter->save('helloWorld.html');
7188
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. */
7491
7592
Settings
7693
--------

docs/src/documentation.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,36 +225,53 @@ $phpWord = new \PhpOffice\PhpWord\PhpWord();
225225
$section = $phpWord->addSection();
226226
// Adding Text element to the Section having font styled by default...
227227
$section->addText(
228-
htmlspecialchars('"Learn from yesterday, live for today, hope for tomorrow. The important thing is not to stop questioning." (Albert Einstein)')
228+
htmlspecialchars(
229+
'"Learn from yesterday, live for today, hope for tomorrow. '
230+
. 'The important thing is not to stop questioning." '
231+
. '(Albert Einstein)'
232+
)
229233
);
230234

231235
/*
232-
* Note: it is possible to customize font style of the Text element you add in three ways:
236+
* Note: it's possible to customize font style of the Text element you add in three ways:
233237
* - inline;
234238
* - using named font style (new font style object will be implicitly created);
235239
* - using explicitly created font style object.
236240
*/
237241

238-
// Adding Text element having font customized inline...
242+
// Adding Text element with font customized inline...
239243
$section->addText(
240-
htmlspecialchars('"Great achievement is usually born of great sacrifice, and is never the result of selfishness." (Napoleon Hill)'),
244+
htmlspecialchars(
245+
'"Great achievement is usually born of great sacrifice, '
246+
. 'and is never the result of selfishness." '
247+
. '(Napoleon Hill)'
248+
),
241249
array('name' => 'Tahoma', 'size' => 10)
242250
);
243251

244-
// Adding Text element having font customized using named font style...
252+
// Adding Text element with font customized using named font style...
245253
$fontStyleName = 'oneUserDefinedStyle';
246-
$phpWord->addFontStyle($fontStyleName, array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true));
254+
$phpWord->addFontStyle(
255+
$fontStyleName,
256+
array('name' => 'Tahoma', 'size' => 10, 'color' => '1B2232', 'bold' => true)
257+
);
247258
$section->addText(
248-
htmlspecialchars('"The greatest accomplishment is not in never falling, but in rising again after you fall." (Vince Lombardi)'),
259+
htmlspecialchars(
260+
'"The greatest accomplishment is not in never falling, '
261+
. 'but in rising again after you fall." '
262+
. '(Vince Lombardi)'
263+
),
249264
$fontStyleName
250265
);
251266

252-
// Adding Text element having font customized using explicitly created font style object...
267+
// Adding Text element with font customized using explicitly created font style object...
253268
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
254269
$fontStyle->setBold(true);
255270
$fontStyle->setName('Tahoma');
256271
$fontStyle->setSize(13);
257-
$myTextElement = $section->addText(htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)'));
272+
$myTextElement = $section->addText(
273+
htmlspecialchars('"Believe you can and you\'re halfway there." (Theodor Roosevelt)')
274+
);
258275
$myTextElement->setFontStyle($fontStyle);
259276

260277
// Saving the document as OOXML file...
@@ -269,8 +286,8 @@ $objWriter->save('helloWorld.odt');
269286
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
270287
$objWriter->save('helloWorld.html');
271288

272-
/* Note: RTF was skipped here, because the format is not XML-based and requires a bit different example. */
273-
/* Note: PDF was skipped here, because we use "HTML-to-PDF" approach to create PDF documents. */
289+
/* Note: we skip RTF, because it's not XML-based and requires a different example. */
290+
/* Note: we skip PDF, because "HTML-to-PDF" approach is used to create PDF documents. */
274291
```
275292

276293
## Settings

0 commit comments

Comments
 (0)