Skip to content

Commit 0bd29cb

Browse files
committed
Simplify README.md and move the full documentation to RST.
1 parent 38a4eb7 commit 0bd29cb

File tree

9 files changed

+148
-743
lines changed

9 files changed

+148
-743
lines changed

README.md

Lines changed: 3 additions & 662 deletions
Large diffs are not rendered by default.

docs/containers.rst

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
Containers
44
==========
55

6+
Containers are objects where you can put elements (texts, lists, tables,
7+
etc). There are 3 main containers, i.e. sections, headers, and footers.
8+
There are 3 elements that can also act as containers, i.e. textruns,
9+
table cells, and footnotes.
10+
611
Sections
712
--------
813

@@ -29,8 +34,8 @@ Section settings
2934

3035
Below are the available settings for section:
3136

32-
- ``orientation`` Page orientation, i.e. portrait (default) or
33-
landscape
37+
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
38+
'landscape'
3439
- ``marginTop`` Page margin top in twips
3540
- ``marginLeft`` Page margin left in twips
3641
- ``marginRight`` Page margin right in twips
@@ -51,21 +56,42 @@ Below are the available settings for section:
5156
evenPage, oddPage)
5257

5358
The following two settings are automatically set by the use of the
54-
``orientation`` setting. You can alter them but thats not recommended.
59+
``orientation`` setting. You can alter them but that's not recommended.
5560

5661
- ``pageSizeW`` Page width in twips
5762
- ``pageSizeH`` Page height in twips
5863

59-
Section page numbering
60-
~~~~~~~~~~~~~~~~~~~~~~
64+
Page number
65+
~~~~~~~~~~~
6166

62-
You can change a section page numbering.
67+
You can change a section page number by using the ``pageNumberingStart``
68+
property of the section.
6369

6470
.. code:: php
6571
72+
// Method 1
73+
$section = $phpWord->createSection(array('pageNumberingStart' => 1));
74+
75+
// Method 2
6676
$section = $phpWord->createSection();
6777
$section->getSettings()->setPageNumberingStart(1);
6878
79+
Multicolumn
80+
~~~~~~~~~~~
81+
82+
You can change a section layout to multicolumn (like in a newspaper) by
83+
using the ``breakType`` and ``colsNum`` property of the section.
84+
85+
.. code:: php
86+
87+
// Method 1
88+
$section = $phpWord->createSection(array('breakType' => 'continuous', 'colsNum' => 2));
89+
90+
// Method 2
91+
$section = $phpWord->createSection();
92+
$section->getSettings()->setBreakType('continuous');
93+
$section->getSettings()->setColsNum(2);
94+
6995
Headers
7096
-------
7197

@@ -77,9 +103,9 @@ the ``createHeader`` method:
77103
$header = $section->createHeader();
78104
79105
Be sure to save the result in a local object. You can use all elements
80-
that are available for the footer. See Footer section for detail.
106+
that are available for the footer. See "Footer" section for detail.
81107
Additionally, only inside of the header reference you can add watermarks
82-
or background pictures. See Watermarks section.
108+
or background pictures. See "Watermarks" section.
83109

84110
Footers
85111
-------
@@ -100,4 +126,11 @@ footer. You can add the following elements to footers:
100126
- Tables
101127
- Preserve text
102128

103-
See the “Elements” section for the detail of each elements.
129+
See the "Elements" section for the detail of each elements.
130+
131+
Other containers
132+
----------------
133+
134+
Textruns, table cells, and footnotes are elements that can also act as
135+
containers. See the corresponding "Elements" section for the detail of
136+
each elements.

docs/elements.rst

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ syntaxes are as follow:
1818
$section->addText($text, [$fontStyle], [$paragraphStyle]);
1919
$textrun = $section->createTextRun([$paragraphStyle]);
2020
21+
Text styles
22+
~~~~~~~~~~~
23+
2124
You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to
2225
define text formatting. There are 2 options to style the inserted text
2326
elements, i.e. inline style by using array or defined style by adding
@@ -49,7 +52,7 @@ Defined style examples:
4952
$text = $section->addText('Hello world!', 'pStyle');
5053
5154
Font style
52-
~~~~~~~~~~
55+
^^^^^^^^^^
5356

5457
Available font styles:
5558

@@ -66,7 +69,7 @@ Available font styles:
6669
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
6770

6871
Paragraph style
69-
~~~~~~~~~~~~~~~
72+
^^^^^^^^^^^^^^^
7073

7174
Available paragraph styles:
7275

@@ -82,7 +85,7 @@ Available paragraph styles:
8285
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
8386
- ``keepLines`` Keep all lines on one page, *true* or *false*
8487
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
85-
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect
88+
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
8689
- ``tabs`` Set of custom tab stops
8790

8891
Titles
@@ -98,7 +101,7 @@ need titles or headings. To add a title to the document, use the
98101
$section->addTitle($text, [$depth]);
99102
100103
Its necessary to add a title style to your document because otherwise
101-
the title wont be detected as a real title.
104+
the title won't be detected as a real title.
102105

103106
Links
104107
~~~~~
@@ -111,8 +114,8 @@ You can add Hyperlinks to the document by using the function addLink:
111114
112115
- ``$linkSrc`` The URL of the link.
113116
- ``$linkName`` Placeholder of the URL that appears in the document.
114-
- ``$fontStyle`` See Font style section.
115-
- ``$paragraphStyle`` See Paragraph style section.
117+
- ``$fontStyle`` See "Font style" section.
118+
- ``$paragraphStyle`` See "Paragraph style" section.
116119

117120
Preserve texts
118121
~~~~~~~~~~~~~~
@@ -138,8 +141,8 @@ syntax. All paramaters are optional.
138141
$section->addTextBreak([$breakCount], [$fontStyle], [$paragraphStyle]);
139142
140143
- ``$breakCount`` How many lines
141-
- ``$fontStyle`` See Font style section.
142-
- ``$paragraphStyle`` See Paragraph style section.
144+
- ``$fontStyle`` See "Font style" section.
145+
- ``$paragraphStyle`` See "Paragraph style" section.
143146

144147
Page breaks
145148
~~~~~~~~~~~
@@ -162,11 +165,11 @@ To add a list item use the function ``addListItem``.
162165
163166
- ``$text`` Text that appears in the document.
164167
- ``$depth`` Depth of list item.
165-
- ``$fontStyle`` See Font style section.
168+
- ``$fontStyle`` See "Font style" section.
166169
- ``$listStyle`` List style of the current element TYPE\_NUMBER,
167170
TYPE\_ALPHANUM, TYPE\_BULLET\_FILLED, etc. See list of constants in
168171
PHPWord\_Style\_ListItem.
169-
- ``$paragraphStyle`` See Paragraph style section.
172+
- ``$paragraphStyle`` See "Paragraph style" section.
170173

171174
Tables
172175
------
@@ -193,12 +196,15 @@ Table style can be defined with ``addTableStyle``:
193196
$PHPWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
194197
$table = $section->addTable('myTable');
195198
199+
Table, row, and cell styles
200+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
201+
196202
Table styles:
197203

198204
- ``$width`` Table width in percent
199-
- ``$bgColor`` Background color, e.g. 9966CC
205+
- ``$bgColor`` Background color, e.g. '9966CC'
200206
- ``$border(Top|Right|Bottom|Left)Size`` Border size in twips
201-
- ``$border(Top|Right|Bottom|Left)Color`` Border color, e.g. 9966CC
207+
- ``$border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
202208
- ``$cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
203209

204210
Row styles:
@@ -211,22 +217,25 @@ Cell styles:
211217
- ``$width`` Cell width in twips
212218
- ``$valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
213219
- ``$textDirection`` Direction of text
214-
- ``$bgColor`` Background color, e.g. 9966CC
220+
- ``$bgColor`` Background color, e.g. '9966CC'
215221
- ``$border(Top|Right|Bottom|Left)Size`` Border size in twips
216-
- ``$border(Top|Right|Bottom|Left)Color`` Border color, e.g. 9966CC
222+
- ``$border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
217223
- ``$gridSpan`` Number of columns spanned
218224
- ``$vMerge`` *restart* or *continue*
219225

220226
Cell span
221227
~~~~~~~~~
222228

223-
You can span a cell on multiple columms.
229+
You can span a cell on multiple columns by using ``gridSpan`` or
230+
multiple rows by using ``vMerge``.
224231

225232
.. code:: php
226233
227234
$cell = $table->addCell(200);
228235
$cell->getStyle()->setGridSpan(5);
229236
237+
See ``Sample_09_Tables.php`` for more code sample.
238+
230239
Images
231240
------
232241

@@ -302,7 +311,7 @@ Table of contents
302311

303312
To add a table of contents (TOC), you can use the ``addTOC`` method.
304313
Your TOC can only be generated if you have add at least one title (See
305-
Titles).
314+
"Titles").
306315

307316
.. code:: php
308317
@@ -317,7 +326,7 @@ Your TOC can only be generated if you have add at least one title (See
317326
Footnotes
318327
---------
319328

320-
You can create footnotes in texts or textruns, but its recommended to
329+
You can create footnotes in texts or textruns, but it's recommended to
321330
use textrun to have better layout.
322331

323332
On textrun:

docs/general.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Basic example
77
-------------
88

99
The following is a basic example of the PHPWord library. More examples
10-
are provided in the `samples folder`.
10+
are provided in the `samples folder <samples/>`__.
1111

1212
.. code:: php
1313
@@ -77,8 +77,8 @@ name. Use the following functions:
7777
Measurement units
7878
-----------------
7979

80-
The base length unit in Open Office XML is twip. Twip means TWentieth
81-
of an Inch Point, i.e. 1 twip = 1/1440 inch.
80+
The base length unit in Open Office XML is twip. Twip means "TWentieth
81+
of an Inch Point", i.e. 1 twip = 1/1440 inch.
8282

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

docs/index.rst

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
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!
7-
===================================
6+
Welcome to PHPWord's documentation
7+
==================================
88

9-
Contents:
9+
|PHPWord|
10+
11+
PHPWord is a library written in pure PHP that provides a set of classes to
12+
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
14+
Document Format for Office Applications (OpenDocument or ODF), and Rich Text
15+
Format (RTF).
1016

1117
.. toctree::
1218
:maxdepth: 2
@@ -17,15 +23,16 @@ Contents:
1723
containers
1824
elements
1925
templates
26+
references
2027
recipes
2128
faq
2229
credits
2330

24-
2531
Indices and tables
2632
==================
2733

2834
* :ref:`genindex`
2935
* :ref:`modindex`
3036
* :ref:`search`
3137

38+
.. |PHPWord| image:: https://raw.github.com/PHPOffice/PHPWord/develop/docs/images/phpword.png

docs/intro.rst

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,35 +5,32 @@ Introduction
55

66
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 XML`_ (OOXML or
9-
OpenXML), OASIS `Open Document Format for Office Applications`_
10-
(OpenDocument or ODF), and `Rich Text Format`_ (RTF).
8+
version of PHPWord supports Microsoft `Office Open
9+
XML <http://en.wikipedia.org/wiki/Office_Open_XML>`__ (OOXML or
10+
OpenXML), OASIS `Open Document Format for Office
11+
Applications <http://en.wikipedia.org/wiki/OpenDocument>`__
12+
(OpenDocument or ODF), and `Rich Text
13+
Format <http://en.wikipedia.org/wiki/Rich_Text_Format>`__ (RTF).
1114

1215
No Windows operating system is needed for usage because the resulting
1316
DOCX, ODT, or RTF files can be opened by all major `word processing
14-
softwares`_.
17+
softwares <http://en.wikipedia.org/wiki/List_of_word_processors>`__.
1518

16-
PHPWord is an open source project licensed under `LGPL`_. PHPWord is
17-
`unit tested`_ to make sure that the released versions are stable.
19+
PHPWord is an open source project licensed under `LGPL <license.md>`__.
20+
PHPWord is `unit tested <https://travis-ci.org/PHPOffice/PHPWord>`__ to
21+
make sure that the released versions are stable.
1822

19-
**Want to contribute?** `Fork us`_ or `submit`_ your bug reports or
20-
feature requests to us.
21-
22-
.. _Office Open XML: http://en.wikipedia.org/wiki/Office_Open_XML
23-
.. _Open Document Format for Office Applications: http://en.wikipedia.org/wiki/OpenDocument
24-
.. _Rich Text Format: http://en.wikipedia.org/wiki/Rich_Text_Format
25-
.. _word processing softwares: http://en.wikipedia.org/wiki/List_of_word_processors
26-
.. _LGPL: license.md
27-
.. _unit tested: https://travis-ci.org/PHPOffice/PHPWord
28-
.. _Fork us: https://github.com/PHPOffice/PHPWord/fork
29-
.. _submit: https://github.com/PHPOffice/PHPWord/issues
23+
**Want to contribute?** `Fork
24+
us <https://github.com/PHPOffice/PHPWord/fork>`__ or
25+
`submit <https://github.com/PHPOffice/PHPWord/issues>`__ your bug
26+
reports or feature requests to us.
3027

3128
Features
3229
--------
3330

3431
- Set document properties, e.g. title, subject, and creator.
35-
- Create document sections with different settings,
36-
e.g. portrait/landscape, page size, and page numbering
32+
- Create document sections with different settings, e.g.
33+
portrait/landscape, page size, and page numbering
3734
- Create header and footer for each sections
3835
- Set default font type, font size, and paragraph style
3936
- Use UTF-8 and East Asia fonts/characters
@@ -54,7 +51,7 @@ Features
5451
- Create document from templates
5552
- Use XSL 1.0 style sheets to transform main document part of OOXML
5653
template
57-
- and many more features on progress
54+
- ... and many more features on progress
5855

5956
File formats
6057
------------

docs/references.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. _references:
2+
3+
References
4+
==========
5+
6+
Formal specifications
7+
---------------------
8+
9+
- `Office Open XML (OOXML) (ECMA-376)
10+
Schema <http://www.schemacentral.com/sc/ooxml/ss.html>`__
11+
- `Oasis OpenDocument Standard Version
12+
1.2 <http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os.html>`__
13+
- `Rich Text Format (RTF) Specification, version
14+
1.9.1 <http://www.microsoft.com/en-us/download/details.aspx?id=10725>`__
15+
16+
Other resources
17+
---------------
18+
19+
- `DocumentFormat.OpenXml.Wordprocessing Namespace on
20+
MSDN <http://msdn.microsoft.com/en-us/library/documentformat.openxml.wordprocessing%28v=office.14%29.aspx>`__

0 commit comments

Comments
 (0)