PHPackages                             trekdev/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. trekdev/phpword

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

trekdev/phpword
===============

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

3.0.8(2mo ago)0164↓50%LGPL-3.0-onlyPHPPHP ^7.1|^8.0CI failing

Since Aug 17Pushed 2mo agoCompare

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

READMEChangelogDependencies (10)Versions (13)Used By (0)

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

[](#)

[![Latest Stable Version](https://camo.githubusercontent.com/949de783397eae27e51954a0eebef3f4c8a24b0a2e7a046b9448fd07084c8994/68747470733a2f2f706f7365722e707567782e6f72672f7068706f66666963652f706870776f72642f76)](https://packagist.org/packages/phpoffice/phpword)[![Coverage Status](https://camo.githubusercontent.com/716a4ec2f6dca9ef012737967f466496eb117bfc316fab3d617179faa3386920/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f5048504f66666963652f504850576f72642f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/PHPOffice/PHPWord?branch=master)[![Total Downloads](https://camo.githubusercontent.com/e554f7d0d667aa69810ef209a043d0701c153cbd445bf1692622f43e2519ee72/68747470733a2f2f706f7365722e707567782e6f72672f7068706f66666963652f706870776f72642f646f776e6c6f616473)](https://packagist.org/packages/phpoffice/phpword)[![License](https://camo.githubusercontent.com/eeacd6afbafe2e4d6ebbcc522becdb2faec01a6193c15e79878dca0b773b52cc/68747470733a2f2f706f7365722e707567782e6f72672f7068706f66666963652f706870776f72642f6c6963656e7365)](https://packagist.org/packages/phpoffice/phpword)

Branch Master : [![PHPWord](https://github.com/PHPOffice/PHPWord/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/PHPOffice/PHPWord/actions/workflows/php.yml)

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](COPYING.LESSER). PHPWord is aimed to be a high quality software product by incorporating [continuous integration](https://github.com/PHPOffice/PHPWord/actions) and unit testing. You can learn more about PHPWord by reading the [Developers' Documentation](https://phpoffice.github.io/PHPWord/).

If you have any questions, please ask on [StackOverFlow](https://stackoverflow.com/questions/tagged/phpword)

Read more about PHPWord:

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Getting started](#getting-started)
- [Contributing](#contributing)
- [Developers' Documentation](https://phpoffice.github.io/PHPWord/)

Features
--------

[](#features)

With PHPWord, you can create OOXML, ODF, or RTF documents dynamically using your PHP 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 headers, main document part, and footers of an OOXML template
- ... and many more features on progress

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

[](#requirements)

PHPWord requires the following:

- PHP 7.1+
- [XML Parser extension](http://www.php.net/manual/en/xml.installation.php)
- [Laminas Escaper component](https://docs.laminas.dev/laminas-escaper/intro/)
- [Zip extension](http://php.net/manual/en/book.zip.php) (optional, used to write OOXML and ODF)
- [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 OOXML and ODF)
- [XSL extension](http://php.net/manual/en/book.xsl.php) (optional, used to apply XSL style sheet to template )
- [dompdf library](https://github.com/dompdf/dompdf) (optional, used to write PDF)

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

[](#installation)

PHPWord is installed via [Composer](https://getcomposer.org/). To [add a dependency](https://getcomposer.org/doc/04-schema.md#package-links) to PHPWord in your project, either

Run the following to use the latest stable version

```
composer require phpoffice/phpword
```

or if you want the latest unreleased version

```
composer require phpoffice/phpword:dev-master
```

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

[](#getting-started)

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

```
