Skip to content

Commit b04eb6c

Browse files
committed
Merge pull request #176 from ivanlanin/develop
Update README.md #174, docs, and version number
2 parents 004edd5 + dfccd54 commit b04eb6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+132
-127
lines changed

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,14 @@ the following lines to your ``composer.json``.
5757
The following is a basic example of the PHPWord library. More examples are provided in the [samples folder](samples/).
5858

5959
```php
60-
$PHPWord = new PHPWord();
60+
require_once 'src/PhpWord/Autoloader.php';
61+
PhpOffice\PhpWord\Autoloader::register();
62+
63+
$phpWord = new \PhpOffice\PhpWord\PhpWord();
6164

6265
// Every element you want to append to the word document is placed in a section.
6366
// To create a basic section:
64-
$section = $PHPWord->createSection();
67+
$section = $phpWord->createSection();
6568

6669
// After creating a section, you can append elements:
6770
$section->addText('Hello world!');
@@ -72,27 +75,27 @@ $section->addText('Hello world! I am formatted.',
7275

7376
// If you often need the same style again you can create a user defined style
7477
// to the word document and give the addText function the name of the style:
75-
$PHPWord->addFontStyle('myOwnStyle',
78+
$phpWord->addFontStyle('myOwnStyle',
7679
array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
7780
$section->addText('Hello world! I am formatted by a user defined style',
7881
'myOwnStyle');
7982

8083
// You can also put the appended element to local object like this:
81-
$fontStyle = new PHPWord_Style_Font();
84+
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
8285
$fontStyle->setBold(true);
8386
$fontStyle->setName('Verdana');
8487
$fontStyle->setSize(22);
8588
$myTextElement = $section->addText('Hello World!');
8689
$myTextElement->setFontStyle($fontStyle);
8790

8891
// Finally, write the document:
89-
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
92+
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
9093
$objWriter->save('helloWorld.docx');
9194

92-
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'ODText');
95+
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
9396
$objWriter->save('helloWorld.odt');
9497

95-
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'RTF');
98+
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF');
9699
$objWriter->save('helloWorld.rtf');
97100
```
98101

docs/general.rst

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ General usage
66
Basic example
77
-------------
88

9-
The following is a basic example of the PHPWord library. More examples
9+
The following is a basic example of the PhpWord library. More examples
1010
are provided in the `samples folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.
1111

1212
.. code-block:: php
1313
14-
require_once '../src/PhpWord/PhpWord.php';
14+
require_once 'src/PhpWord/Autoloader.php';
15+
PhpOffice\PhpWord\Autoloader::register();
1516
1617
$phpWord = new \PhpOffice\PhpWord\PhpWord();
1718
@@ -34,17 +35,23 @@ are provided in the `samples folder <https://github.com/PHPOffice/PHPWord/tree/m
3435
'myOwnStyle');
3536
3637
// You can also put the appended element to local object like this:
37-
$fontStyle = new PHPWord_Style_Font();
38+
$fontStyle = new \PhpOffice\PhpWord\Style\Font();
3839
$fontStyle->setBold(true);
3940
$fontStyle->setName('Verdana');
4041
$fontStyle->setSize(22);
4142
$myTextElement = $section->addText('Hello World!');
4243
$myTextElement->setFontStyle($fontStyle);
4344
4445
// Finally, write the document:
45-
$objWriter = PHPWord_IOFactory::createWriter($phpWord, 'Word2007');
46+
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
4647
$objWriter->save('helloWorld.docx');
4748
49+
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
50+
$objWriter->save('helloWorld.odt');
51+
52+
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF');
53+
$objWriter->save('helloWorld.rtf');
54+
4855
Default font
4956
------------
5057

@@ -82,19 +89,19 @@ Measurement units
8289
The base length unit in Open Office XML is twip. Twip means "TWentieth
8390
of an Inch Point", i.e. 1 twip = 1/1440 inch.
8491

85-
You can use PHPWord helper functions to convert inches, centimeters, or
92+
You can use PhpWord helper functions to convert inches, centimeters, or
8693
points to twips.
8794

8895
.. code-block:: php
8996
9097
// Paragraph with 6 points space after
9198
$phpWord->addParagraphStyle('My Style', array(
92-
'spaceAfter' => PHPWord_Shared_Font::pointSizeToTwips(6))
99+
'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
93100
);
94101
95102
$section = $phpWord->createSection();
96103
$sectionStyle = $section->getSettings();
97104
// half inch left margin
98-
$sectionStyle->setMarginLeft(PHPWord_Shared_Font::inchSizeToTwips(.5));
105+
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
99106
// 2 cm right margin
100-
$sectionStyle->setMarginRight(PHPWord_Shared_Font::centimeterSizeToTwips(2));
107+
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2));

docs/index.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
Welcome to PHPWord's documentation
6+
Welcome to PhpWord's documentation
77
==================================
88

9-
|PHPWord|
9+
|PhpWord|
1010

11-
PHPWord is a library written in pure PHP that provides a set of classes to
11+
PhpWord is a library written in pure PHP that provides a set of classes to
1212
write to and read from different document file formats. The current version of
13-
PHPWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open
13+
PhpWord supports Microsoft Office Open XML (OOXML or OpenXML), OASIS Open
1414
Document Format for Office Applications (OpenDocument or ODF), and Rich Text
1515
Format (RTF).
1616

@@ -35,4 +35,4 @@ Indices and tables
3535
* :ref:`modindex`
3636
* :ref:`search`
3737

38-
.. |PHPWord| image:: images/phpword.png
38+
.. |PhpWord| image:: images/phpword.png

docs/intro.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Introduction
44
============
55

6-
PHPWord is a library written in pure PHP that provides a set of classes
6+
PhpWord is a library written in pure PHP that provides a set of classes
77
to write to and read from different document file formats. The current
8-
version of PHPWord supports Microsoft `Office Open
8+
version of PhpWord supports Microsoft `Office Open
99
XML <http://en.wikipedia.org/wiki/Office_Open_XML>`__ (OOXML or
1010
OpenXML), OASIS `Open Document Format for Office
1111
Applications <http://en.wikipedia.org/wiki/OpenDocument>`__
@@ -16,8 +16,8 @@ No Windows operating system is needed for usage because the resulting
1616
DOCX, ODT, or RTF files can be opened by all major `word processing
1717
softwares <http://en.wikipedia.org/wiki/List_of_word_processors>`__.
1818

19-
PHPWord is an open source project licensed under LGPL.
20-
PHPWord is `unit tested <https://travis-ci.org/PHPOffice/PHPWord>`__ to
19+
PhpWord is an open source project licensed under LGPL.
20+
PhpWord is `unit tested <https://travis-ci.org/PHPOffice/PHPWord>`__ to
2121
make sure that the released versions are stable.
2222

2323
**Want to contribute?** `Fork

docs/setup.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Optional PHP extensions:
2323
Installation
2424
------------
2525

26-
There are two ways to install PHPWord, i.e. via
26+
There are two ways to install PhpWord, i.e. via
2727
`Composer <http://getcomposer.org/>`__ or manually by downloading the
2828
library.
2929

@@ -44,7 +44,7 @@ To install via Composer, add the following lines to your
4444
Manual install
4545
~~~~~~~~~~~~~~
4646

47-
To install manually, `download PHPWord package from
47+
To install manually, `download PhpWord package from
4848
github <https://github.com/PHPOffice/PHPWord/archive/master.zip>`__.
4949
Extract the package and put the contents to your machine. To use the
5050
library, include ``src/PhpWord/Autoloader.php`` in your script and
@@ -60,5 +60,5 @@ Using samples
6060

6161
After installation, you can browse and use the samples that we've
6262
provided, either by command line or using browser. If you can access
63-
your PHPWord library folder using browser, point your browser to the
63+
your PhpWord library folder using browser, point your browser to the
6464
``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``.

docs/templates.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ replaced by any value you wish. Only single-line values can be replaced.
88
To load a template file, use the ``loadTemplate`` method. After loading
99
the docx template, you can use the ``setValue`` method to change the
1010
value of a search pattern. The search-pattern model is:
11-
``${search-pattern}``. It is not possible to add new PHPWord elements to
11+
``${search-pattern}``. It is not possible to add new PhpWord elements to
1212
a loaded template file.
1313

1414
Example:

src/PhpWord/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

src/PhpWord/DocumentProperties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

src/PhpWord/Exceptions/Exception.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* PHPWord
3+
* PhpWord
44
*
5-
* Copyright (c) 2014 PHPWord
5+
* Copyright (c) 2014 PhpWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -18,12 +18,11 @@
1818
* License along with this library; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020
*
21-
* @category PHPWord
22-
* @package PHPWord
23-
* @copyright Copyright (c) 2014 PHPWord
21+
* @copyright Copyright (c) 2014 PhpWord
2422
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25-
* @version 0.8.0
23+
* @version 0.9.0
2624
*/
25+
2726
namespace PhpOffice\PhpWord\Exceptions;
2827

2928
/**

src/PhpWord/Exceptions/InvalidImageException.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* PHPWord
3+
* PhpWord
44
*
5-
* Copyright (c) 2014 PHPWord
5+
* Copyright (c) 2014 PhpWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -18,12 +18,11 @@
1818
* License along with this library; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020
*
21-
* @category PHPWord
22-
* @package PHPWord
23-
* @copyright Copyright (c) 2014 PHPWord
21+
* @copyright Copyright (c) 2014 PhpWord
2422
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25-
* @version 0.8.0
23+
* @version 0.9.0
2624
*/
25+
2726
namespace PhpOffice\PhpWord\Exceptions;
2827

2928
/**

src/PhpWord/Exceptions/InvalidObjectException.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* PHPWord
3+
* PhpWord
44
*
5-
* Copyright (c) 2014 PHPWord
5+
* Copyright (c) 2014 PhpWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -18,12 +18,11 @@
1818
* License along with this library; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020
*
21-
* @category PHPWord
22-
* @package PHPWord
23-
* @copyright Copyright (c) 2014 PHPWord
21+
* @copyright Copyright (c) 2014 PhpWord
2422
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25-
* @version 0.8.0
23+
* @version 0.9.0
2624
*/
25+
2726
namespace PhpOffice\PhpWord\Exceptions;
2827

2928
/**

src/PhpWord/Exceptions/InvalidStyleException.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* PHPWord
3+
* PhpWord
44
*
5-
* Copyright (c) 2014 PHPWord
5+
* Copyright (c) 2014 PhpWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -18,12 +18,11 @@
1818
* License along with this library; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020
*
21-
* @category PHPWord
22-
* @package PHPWord
23-
* @copyright Copyright (c) 2014 PHPWord
21+
* @copyright Copyright (c) 2014 PhpWord
2422
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25-
* @version 0.8.0
23+
* @version 0.9.0
2624
*/
25+
2726
namespace PhpOffice\PhpWord\Exceptions;
2827

2928
use InvalidArgumentException;

src/PhpWord/Exceptions/UnsupportedImageTypeException.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?php
22
/**
3-
* PHPWord
3+
* PhpWord
44
*
5-
* Copyright (c) 2014 PHPWord
5+
* Copyright (c) 2014 PhpWord
66
*
77
* This library is free software; you can redistribute it and/or
88
* modify it under the terms of the GNU Lesser General Public
@@ -18,12 +18,11 @@
1818
* License along with this library; if not, write to the Free Software
1919
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2020
*
21-
* @category PHPWord
22-
* @package PHPWord
23-
* @copyright Copyright (c) 2014 PHPWord
21+
* @copyright Copyright (c) 2014 PhpWord
2422
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
25-
* @version 0.8.0
23+
* @version 0.9.0
2624
*/
25+
2726
namespace PhpOffice\PhpWord\Exceptions;
2827

2928
/**

src/PhpWord/Footnote.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

src/PhpWord/HashTable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

src/PhpWord/IOFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

src/PhpWord/Media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

src/PhpWord/PhpWord.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
* @copyright Copyright (c) 2014 PhpWord
2222
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
23-
* @version 0.8.0
23+
* @version 0.9.0
2424
*/
2525

2626
namespace PhpOffice\PhpWord;

0 commit comments

Comments
 (0)