Skip to content

Commit 68a4387

Browse files
committed
Reformat code samples on README.md to max 80 char per line
1 parent d177b47 commit 68a4387

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,29 +50,33 @@ The following is a basic example of the PHPWord library.
5050
```php
5151
$PHPWord = new PHPWord();
5252

53-
// Every element you want to append to the word document is placed in a section. So you need a section:
53+
// Every element you want to append to the word document is placed in a section.
54+
// To create a basic section:
5455
$section = $PHPWord->createSection();
5556

5657
// After creating a section, you can append elements:
5758
$section->addText('Hello world!');
5859

5960
// You can directly style your text by giving the addText function an array:
60-
$section->addText('Hello world! I am formatted.', array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
61+
$section->addText('Hello world! I am formatted.',
62+
array('name'=>'Tahoma', 'size'=>16, 'bold'=>true));
6163

62-
// If you often need the same style again you can create a user defined style to the word document
63-
// and give the addText function the name of the style:
64-
$PHPWord->addFontStyle('myOwnStyle', array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
65-
$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle');
64+
// If you often need the same style again you can create a user defined style
65+
// to the word document and give the addText function the name of the style:
66+
$PHPWord->addFontStyle('myOwnStyle',
67+
array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
68+
$section->addText('Hello world! I am formatted by a user defined style',
69+
'myOwnStyle');
6670

67-
// You can also putthe appended element to local object an call functions like this:
71+
// You can also put the appended element to local object like this:
6872
$fontStyle = new PHPWord_Style_Font();
6973
$fontStyle->setBold(true);
7074
$fontStyle->setName('Verdana');
7175
$fontStyle->setSize(22);
7276
$myTextElement = $section->addText('Hello World!');
7377
$myTextElement->setFontStyle($fontStyle);
7478

75-
// At least write the document to webspace:
79+
// Finally, write the document:
7680
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
7781
$objWriter->save('helloWorld.docx');
7882
```

0 commit comments

Comments
 (0)