Skip to content

Update README.md #174, docs, and version number #176

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,14 @@ the following lines to your ``composer.json``.
The following is a basic example of the PHPWord library. More examples are provided in the [samples folder](samples/).

```php
$PHPWord = new PHPWord();
require_once 'src/PhpWord/Autoloader.php';
PhpOffice\PhpWord\Autoloader::register();

$phpWord = new \PhpOffice\PhpWord\PhpWord();

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

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

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

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

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

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

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

Expand Down
23 changes: 15 additions & 8 deletions docs/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ General usage
Basic example
-------------

The following is a basic example of the PHPWord library. More examples
The following is a basic example of the PhpWord library. More examples
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you changed the name of the project ? The name doesn't change.

are provided in the `samples folder <https://github.com/PHPOffice/PHPWord/tree/master/samples/>`__.

.. code-block:: php

require_once '../src/PhpWord/PhpWord.php';
require_once 'src/PhpWord/Autoloader.php';
PhpOffice\PhpWord\Autoloader::register();

$phpWord = new \PhpOffice\PhpWord\PhpWord();

Expand All @@ -34,17 +35,23 @@ are provided in the `samples folder <https://github.com/PHPOffice/PHPWord/tree/m
'myOwnStyle');

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

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

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'ODText');
$objWriter->save('helloWorld.odt');

$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'RTF');
$objWriter->save('helloWorld.rtf');

Default font
------------

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

You can use PHPWord helper functions to convert inches, centimeters, or
You can use PhpWord helper functions to convert inches, centimeters, or
points to twips.

.. code-block:: php

// Paragraph with 6 points space after
$phpWord->addParagraphStyle('My Style', array(
'spaceAfter' => PHPWord_Shared_Font::pointSizeToTwips(6))
'spaceAfter' => \PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
);

$section = $phpWord->createSection();
$sectionStyle = $section->getSettings();
// half inch left margin
$sectionStyle->setMarginLeft(PHPWord_Shared_Font::inchSizeToTwips(.5));
$sectionStyle->setMarginLeft(\PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
// 2 cm right margin
$sectionStyle->setMarginRight(PHPWord_Shared_Font::centimeterSizeToTwips(2));
$sectionStyle->setMarginRight(\PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwips(2));
10 changes: 5 additions & 5 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to PHPWord's documentation
Welcome to PhpWord's documentation
==================================

|PHPWord|
|PhpWord|

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

Expand All @@ -35,4 +35,4 @@ Indices and tables
* :ref:`modindex`
* :ref:`search`

.. |PHPWord| image:: images/phpword.png
.. |PhpWord| image:: images/phpword.png
8 changes: 4 additions & 4 deletions docs/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Introduction
============

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

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

**Want to contribute?** `Fork
Expand Down
6 changes: 3 additions & 3 deletions docs/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Optional PHP extensions:
Installation
------------

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

Expand All @@ -44,7 +44,7 @@ To install via Composer, add the following lines to your
Manual install
~~~~~~~~~~~~~~

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

After installation, you can browse and use the samples that we've
provided, either by command line or using browser. If you can access
your PHPWord library folder using browser, point your browser to the
your PhpWord library folder using browser, point your browser to the
``samples`` folder, e.g. ``http://localhost/PhpWord/samples/``.
2 changes: 1 addition & 1 deletion docs/templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ replaced by any value you wish. Only single-line values can be replaced.
To load a template file, use the ``loadTemplate`` method. After loading
the docx template, you can use the ``setValue`` method to change the
value of a search pattern. The search-pattern model is:
``${search-pattern}``. It is not possible to add new PHPWord elements to
``${search-pattern}``. It is not possible to add new PhpWord elements to
a loaded template file.

Example:
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/DocumentProperties.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
11 changes: 5 additions & 6 deletions src/PhpWord/Exceptions/Exception.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* PHPWord
* PhpWord
*
* Copyright (c) 2014 PHPWord
* Copyright (c) 2014 PhpWord
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,12 +18,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord\Exceptions;

/**
Expand Down
11 changes: 5 additions & 6 deletions src/PhpWord/Exceptions/InvalidImageException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* PHPWord
* PhpWord
*
* Copyright (c) 2014 PHPWord
* Copyright (c) 2014 PhpWord
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,12 +18,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord\Exceptions;

/**
Expand Down
11 changes: 5 additions & 6 deletions src/PhpWord/Exceptions/InvalidObjectException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* PHPWord
* PhpWord
*
* Copyright (c) 2014 PHPWord
* Copyright (c) 2014 PhpWord
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,12 +18,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord\Exceptions;

/**
Expand Down
11 changes: 5 additions & 6 deletions src/PhpWord/Exceptions/InvalidStyleException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* PHPWord
* PhpWord
*
* Copyright (c) 2014 PHPWord
* Copyright (c) 2014 PhpWord
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,12 +18,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord\Exceptions;

use InvalidArgumentException;
Expand Down
11 changes: 5 additions & 6 deletions src/PhpWord/Exceptions/UnsupportedImageTypeException.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* PHPWord
* PhpWord
*
* Copyright (c) 2014 PHPWord
* Copyright (c) 2014 PhpWord
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand All @@ -18,12 +18,11 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPWord
* @package PHPWord
* @copyright Copyright (c) 2014 PHPWord
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord\Exceptions;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Footnote.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/HashTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/IOFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/Media.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
2 changes: 1 addition & 1 deletion src/PhpWord/PhpWord.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0
* @version 0.9.0
*/

namespace PhpOffice\PhpWord;
Expand Down
Loading