PHPackages                             sniperx1414/phpword - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. sniperx1414/phpword

ActiveLibrary[Templating &amp; Views](/categories/templating)

sniperx1414/phpword
===================

PHPWord - A pure PHP library for reading and writing word processing documents (DOCX, ODT, RTF, HTML, PDF)

v0.12.4(9y ago)269↓100%2LGPL-3.0PHPPHP &gt;=5.3.3

Since Jan 28Pushed 9y ago1 watchersCompare

[ Source](https://github.com/sniperx1414/PhpWord)[ Packagist](https://packagist.org/packages/sniperx1414/phpword)[ Docs](http://phpoffice.github.io)[ RSS](/packages/sniperx1414-phpword/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (9)Versions (16)Used By (0)

[![PHPWord](https://camo.githubusercontent.com/a6d097ba5a038dd7bdd585725993c9b4f84fc3991db442a45e4477ed08634ec4/68747470733a2f2f7261776769742e636f6d2f5048504f66666963652f504850576f72642f646576656c6f702f646f63732f696d616765732f706870776f72642e737667 "PHPWord")](https://camo.githubusercontent.com/a6d097ba5a038dd7bdd585725993c9b4f84fc3991db442a45e4477ed08634ec4/68747470733a2f2f7261776769742e636f6d2f5048504f66666963652f504850576f72642f646576656c6f702f646f63732f696d616765732f706870776f72642e737667)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#)

[![Latest Stable Version](https://camo.githubusercontent.com/7b9f38de1b2dd5cd3a86914bdb25d475786c9f6c1cb6d8e19d8a8f2dde1efe99/68747470733a2f2f706f7365722e707567782e6f72672f7068706f66666963652f706870776f72642f762f737461626c652e706e67)](https://packagist.org/packages/phpoffice/phpword)[![Build Status](https://camo.githubusercontent.com/ae5bc4e9416be1734af3111247fef53dbd6b00a34e551603896200575c9745de/68747470733a2f2f7472617669732d63692e6f72672f5048504f66666963652f504850576f72642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PHPOffice/PHPWord)[![Code Quality](https://camo.githubusercontent.com/fa57dffe17168934cefa6d39e9cebdad15d55e76f5e718461d51a8f07596acbc/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5048504f66666963652f504850576f72642f6261646765732f7175616c6974792d73636f72652e706e673f733d62353939376365353961633238313662343531346633613338646539393030663664343932633164)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)[![Code Coverage](https://camo.githubusercontent.com/a790dd0fe52f159fe1632fcfb533c2977b217686a3aba695124025f07ebbee4a/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5048504f66666963652f504850576f72642f6261646765732f636f7665726167652e706e673f733d37343261393837343537323563353632393535343430656463386432633339643766663561653235)](https://scrutinizer-ci.com/g/PHPOffice/PHPWord/)[![Total Downloads](https://camo.githubusercontent.com/d97df9d916eb9121ab930ceb61b76d4c525a183a90b29b2ae7dd3769f96289ab/68747470733a2f2f706f7365722e707567782e6f72672f7068706f66666963652f706870776f72642f646f776e6c6f6164732e706e67)](https://packagist.org/packages/phpoffice/phpword)[![License](https://camo.githubusercontent.com/080d360620a1abbf69ace6acaf1f9c97c8ede891bee8820c1fca463358a835b6/68747470733a2f2f706f7365722e707567782e6f72672f7068706f66666963652f706870776f72642f6c6963656e73652e706e67)](https://packagist.org/packages/phpoffice/phpword)

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](http://en.wikipedia.org/wiki/Office_Open_XML) (OOXML or OpenXML), OASIS [Open Document Format for Office Applications](http://en.wikipedia.org/wiki/OpenDocument) (OpenDocument or ODF), [Rich Text Format](http://en.wikipedia.org/wiki/Rich_Text_Format) (RTF), HTML, and PDF.

PHPWord is an open source project licensed under the terms of [LGPL version 3](https://github.com/PHPOffice/PHPWord/blob/develop/COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://travis-ci.org/PHPOffice/PHPWord) and [unit testing](http://phpoffice.github.io/PHPWord/coverage/develop/). You can learn more about PHPWord by reading the [Developers' Documentation](http://phpword.readthedocs.org/) and the [API Documentation](http://phpoffice.github.io/PHPWord/docs/develop/).

Read more about PHPWord:

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Getting started](#getting-started)
- [Contributing](#contributing)
- [Developers' Documentation](http://phpword.readthedocs.org/)
- [API Documentation](http://phpoffice.github.io/PHPWord/docs/master/)

Features
--------

[](#features)

With PHPWord, you can create DOCX, ODT, or RTF documents dynamically using your PHP 5.3+ scripts. Below are some of the things that you can do with PHPWord library:

- Set document properties, e.g. title, subject, and creator.
- Create document sections with different settings, e.g. portrait/landscape, page size, and page numbering
- Create header and footer for each sections
- Set default font type, font size, and paragraph style
- Use UTF-8 and East Asia fonts/characters
- Define custom font styles (e.g. bold, italic, color) and paragraph styles (e.g. centered, multicolumns, spacing) either as named style or inline in text
- Insert paragraphs, either as a simple text or complex one (a text run) that contains other elements
- Insert titles (headers) and table of contents
- Insert text breaks and page breaks
- Insert and format images, either local, remote, or as page watermarks
- Insert binary OLE Objects such as Excel or Visio
- Insert and format table with customized properties for each rows (e.g. repeat as header row) and cells (e.g. background color, rowspan, colspan)
- Insert list items as bulleted, numbered, or multilevel
- Insert hyperlinks
- Insert footnotes and endnotes
- Insert drawing shapes (arc, curve, line, polyline, rect, oval)
- Insert charts (pie, doughnut, bar, line, area, scatter, radar)
- Insert form fields (textinput, checkbox, and dropdown)
- Create document from templates
- Use XSL 1.0 style sheets to transform main document part of OOXML template
- ... and many more features on progress

Requirements
------------

[](#requirements)

PHPWord requires the following:

- PHP 5.3+
- [Zip extension](http://php.net/manual/en/book.zip.php)
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- [GD extension](http://php.net/manual/en/book.image.php) (optional, used to add images)
- [XMLWriter extension](http://php.net/manual/en/book.xmlwriter.php) (optional, used to write DOCX and ODT)
- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )
- [dompdf](https://github.com/dompdf/dompdf) (optional, used to write PDF)

Installation
------------

[](#installation)

It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add the following lines to your `composer.json`.

```
{
    "require": {
       "phpoffice/phpword": "dev-master"
    }
}
```

Alternatively, you can download the latest release from the [releases page](https://github.com/PHPOffice/PHPWord/releases). In this case, you will have to register the autoloader.

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

Getting started
---------------

[](#getting-started)

The following is a basic usage example of the PHPWord library.

```
