Docs: Restructure documentation
This commit is contained in:
parent
63d53ac910
commit
3197524343
|
|
@ -41,14 +41,14 @@ master_doc = 'index'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'PhpWord'
|
project = u'PhpWord'
|
||||||
copyright = u'2014, Progi1984'
|
copyright = u'2014, PHPWord Contributors'
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.9.0'
|
version = '0.12.0'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = version
|
release = version
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,52 +16,19 @@ section, use the following code:
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
$section = $phpWord->addSection($sectionSettings);
|
$section = $phpWord->addSection($sectionStyle);
|
||||||
|
|
||||||
The ``$sectionSettings`` is an optional associative array that sets the
|
The ``$sectionStyle`` is an optional associative array that sets the
|
||||||
section. Example:
|
section. Example:
|
||||||
|
|
||||||
.. code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
$sectionSettings = array(
|
$sectionStyle = array(
|
||||||
'orientation' => 'landscape',
|
'orientation' => 'landscape',
|
||||||
'marginTop' => 600,
|
'marginTop' => 600,
|
||||||
'colsNum' => 2,
|
'colsNum' => 2,
|
||||||
);
|
);
|
||||||
|
|
||||||
Section settings
|
|
||||||
~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Below are the available styles for section:
|
|
||||||
|
|
||||||
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
|
|
||||||
'landscape'
|
|
||||||
- ``marginTop`` Page margin top in twips
|
|
||||||
- ``marginLeft`` Page margin left in twips
|
|
||||||
- ``marginRight`` Page margin right in twips
|
|
||||||
- ``marginBottom`` Page margin bottom in twips
|
|
||||||
- ``borderTopSize`` Border top size in twips
|
|
||||||
- ``borderTopColor`` Border top color
|
|
||||||
- ``borderLeftSize`` Border left size in twips
|
|
||||||
- ``borderLeftColor`` Border left color
|
|
||||||
- ``borderRightSize`` Border right size in twips
|
|
||||||
- ``borderRightColor`` Border right color
|
|
||||||
- ``borderBottomSize`` Border bottom size in twips
|
|
||||||
- ``borderBottomColor`` Border bottom color
|
|
||||||
- ``headerHeight`` Spacing to top of header
|
|
||||||
- ``footerHeight`` Spacing to bottom of footer
|
|
||||||
- ``gutter`` Page gutter spacing
|
|
||||||
- ``colsNum`` Number of columns
|
|
||||||
- ``colsSpace`` Spacing between columns
|
|
||||||
- ``breakType`` Section break type (nextPage, nextColumn, continuous,
|
|
||||||
evenPage, oddPage)
|
|
||||||
|
|
||||||
The following two styles are automatically set by the use of the
|
|
||||||
``orientation`` style. You can alter them but that's not recommended.
|
|
||||||
|
|
||||||
- ``pageSizeW`` Page width in twips
|
|
||||||
- ``pageSizeH`` Page height in twips
|
|
||||||
|
|
||||||
Page number
|
Page number
|
||||||
~~~~~~~~~~~
|
~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
@ -93,8 +60,8 @@ using the ``breakType`` and ``colsNum`` style of the section.
|
||||||
$section->getStyle()->setBreakType('continuous');
|
$section->getStyle()->setBreakType('continuous');
|
||||||
$section->getStyle()->setColsNum(2);
|
$section->getStyle()->setColsNum(2);
|
||||||
|
|
||||||
|
Line numbering
|
||||||
### Line numbering
|
~~~~~~~~~~~~~~
|
||||||
|
|
||||||
You can apply line numbering to a section by using the ``lineNumbering``
|
You can apply line numbering to a section by using the ``lineNumbering``
|
||||||
style of the section.
|
style of the section.
|
||||||
|
|
@ -113,7 +80,8 @@ Below are the properties of the line numbering style.
|
||||||
- ``start`` Line numbering starting value
|
- ``start`` Line numbering starting value
|
||||||
- ``increment`` Line number increments
|
- ``increment`` Line number increments
|
||||||
- ``distance`` Distance between text and line numbering in twip
|
- ``distance`` Distance between text and line numbering in twip
|
||||||
- ``restart`` Line numbering restart setting continuous|newPage|newSection
|
- ``restart`` Line numbering restart setting
|
||||||
|
continuous\|newPage\|newSection
|
||||||
|
|
||||||
Headers
|
Headers
|
||||||
-------
|
-------
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ column shows the containers while the rows lists the elements.
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
| 19 | Line | v | v | v | v | v | v |
|
| 19 | Line | v | v | v | v | v | v |
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
| 20 | Shapes | v | v | v | v | v | v |
|
| 20 | Shape | v | v | v | v | v | v |
|
||||||
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
+-------+-----------------+-----------+----------+----------+---------+------------+------------+
|
||||||
|
|
||||||
Legend:
|
Legend:
|
||||||
|
|
@ -73,9 +73,6 @@ as follow:
|
||||||
$section->addText($text, [$fontStyle], [$paragraphStyle]);
|
$section->addText($text, [$fontStyle], [$paragraphStyle]);
|
||||||
$textrun = $section->addTextRun([$paragraphStyle]);
|
$textrun = $section->addTextRun([$paragraphStyle]);
|
||||||
|
|
||||||
Text styles
|
|
||||||
~~~~~~~~~~~
|
|
||||||
|
|
||||||
You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to
|
You can use the ``$fontStyle`` and ``$paragraphStyle`` variable to
|
||||||
define text formatting. There are 2 options to style the inserted text
|
define text formatting. There are 2 options to style the inserted text
|
||||||
elements, i.e. inline style by using array or defined style by adding
|
elements, i.e. inline style by using array or defined style by adding
|
||||||
|
|
@ -106,47 +103,6 @@ Defined style examples:
|
||||||
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
|
$phpWord->addParagraphStyle('pStyle', $paragraphStyle);
|
||||||
$text = $section->addText('Hello world!', 'pStyle');
|
$text = $section->addText('Hello world!', 'pStyle');
|
||||||
|
|
||||||
Font style
|
|
||||||
^^^^^^^^^^
|
|
||||||
|
|
||||||
Available font styles:
|
|
||||||
|
|
||||||
- ``name`` Font name, e.g. *Arial*
|
|
||||||
- ``size`` Font size, e.g. *20*, *22*,
|
|
||||||
- ``hint`` Font content type, *default*, *eastAsia*, or *cs*
|
|
||||||
- ``bold`` Bold, *true* or *false*
|
|
||||||
- ``italic`` Italic, *true* or *false*
|
|
||||||
- ``superScript`` Superscript, *true* or *false*
|
|
||||||
- ``subScript`` Subscript, *true* or *false*
|
|
||||||
- ``underline`` Underline, *dash*, *dotted*, etc.
|
|
||||||
- ``strikethrough`` Strikethrough, *true* or *false*
|
|
||||||
- ``doubleStrikethrough`` Double strikethrough, *true* or *false*
|
|
||||||
- ``color`` Font color, e.g. *FF0000*
|
|
||||||
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
|
|
||||||
- ``bgColor`` Font background color, e.g. *FF0000*
|
|
||||||
- ``smallCaps`` Small caps, *true* or *false*
|
|
||||||
- ``allCaps`` All caps, *true* or *false*
|
|
||||||
|
|
||||||
Paragraph style
|
|
||||||
^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
Available paragraph styles:
|
|
||||||
|
|
||||||
- ``align`` Paragraph alignment, *left*, *right* or *center*
|
|
||||||
- ``spaceBefore`` Space before paragraph
|
|
||||||
- ``spaceAfter`` Space after paragraph
|
|
||||||
- ``indent`` Indent by how much
|
|
||||||
- ``hanging`` Hanging by how much
|
|
||||||
- ``basedOn`` Parent style
|
|
||||||
- ``next`` Style for next paragraph
|
|
||||||
- ``widowControl`` Allow first/last line to display on a separate page,
|
|
||||||
*true* or *false*
|
|
||||||
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
|
|
||||||
- ``keepLines`` Keep all lines on one page, *true* or *false*
|
|
||||||
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
|
|
||||||
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
|
|
||||||
- ``tabs`` Set of custom tab stops
|
|
||||||
|
|
||||||
Titles
|
Titles
|
||||||
~~~~~~
|
~~~~~~
|
||||||
|
|
||||||
|
|
@ -209,9 +165,9 @@ Page breaks
|
||||||
There are two ways to insert a page breaks, using the ``addPageBreak``
|
There are two ways to insert a page breaks, using the ``addPageBreak``
|
||||||
method or using the ``pageBreakBefore`` style of paragraph.
|
method or using the ``pageBreakBefore`` style of paragraph.
|
||||||
|
|
||||||
:: code-block:: php
|
.. code-block:: php
|
||||||
|
|
||||||
\\$section->addPageBreak();
|
$section->addPageBreak();
|
||||||
|
|
||||||
Lists
|
Lists
|
||||||
-----
|
-----
|
||||||
|
|
@ -254,23 +210,6 @@ You can also create your own numbering style by changing the
|
||||||
$section->addListItem('List Item I.b', 1, null, 'multilevel');
|
$section->addListItem('List Item I.b', 1, null, 'multilevel');
|
||||||
$section->addListItem('List Item II', 0, null, 'multilevel');
|
$section->addListItem('List Item II', 0, null, 'multilevel');
|
||||||
|
|
||||||
Level styles:
|
|
||||||
|
|
||||||
- ``start`` Starting value
|
|
||||||
- ``format`` Numbering format
|
|
||||||
bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter
|
|
||||||
- ``restart`` Restart numbering level symbol
|
|
||||||
- ``suffix`` Content between numbering symbol and paragraph text
|
|
||||||
tab\|space\|nothing
|
|
||||||
- ``text`` Numbering level text e.g. %1 for nonbullet or bullet
|
|
||||||
character
|
|
||||||
- ``align`` Numbering symbol align left\|center\|right\|both
|
|
||||||
- ``left`` See paragraph style
|
|
||||||
- ``hanging`` See paragraph style
|
|
||||||
- ``tabPos`` See paragraph style
|
|
||||||
- ``font`` Font name
|
|
||||||
- ``hint`` See font style
|
|
||||||
|
|
||||||
Tables
|
Tables
|
||||||
------
|
------
|
||||||
|
|
||||||
|
|
@ -296,34 +235,6 @@ Table style can be defined with ``addTableStyle``:
|
||||||
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
|
$phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
|
||||||
$table = $section->addTable('myTable');
|
$table = $section->addTable('myTable');
|
||||||
|
|
||||||
Table, row, and cell styles
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Table styles:
|
|
||||||
|
|
||||||
- ``width`` Table width in percent
|
|
||||||
- ``bgColor`` Background color, e.g. '9966CC'
|
|
||||||
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
|
||||||
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
|
||||||
- ``cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
|
|
||||||
|
|
||||||
Row styles:
|
|
||||||
|
|
||||||
- ``tblHeader`` Repeat table row on every new page, *true* or *false*
|
|
||||||
- ``cantSplit`` Table row cannot break across pages, *true* or *false*
|
|
||||||
- ``exactHeight`` Row height is exact or at least
|
|
||||||
|
|
||||||
Cell styles:
|
|
||||||
|
|
||||||
- ``width`` Cell width in twips
|
|
||||||
- ``valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
|
|
||||||
- ``textDirection`` Direction of text
|
|
||||||
- ``bgColor`` Background color, e.g. '9966CC'
|
|
||||||
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
|
||||||
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
|
||||||
- ``gridSpan`` Number of columns spanned
|
|
||||||
- ``vMerge`` *restart* or *continue*
|
|
||||||
|
|
||||||
Cell span
|
Cell span
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
|
|
@ -370,19 +281,6 @@ Examples:
|
||||||
$textrun = $section->addTextRun();
|
$textrun = $section->addTextRun();
|
||||||
$textrun->addImage('http://php.net/logo.jpg');
|
$textrun->addImage('http://php.net/logo.jpg');
|
||||||
|
|
||||||
Image styles
|
|
||||||
~~~~~~~~~~~~
|
|
||||||
|
|
||||||
Available image styles:
|
|
||||||
|
|
||||||
- ``width`` Width in pixels
|
|
||||||
- ``height`` Height in pixels
|
|
||||||
- ``align`` Image alignment, *left*, *right*, or *center*
|
|
||||||
- ``marginTop`` Top margin in inches, can be negative
|
|
||||||
- ``marginLeft`` Left margin in inches, can be negative
|
|
||||||
- ``wrappingStyle`` Wrapping style, *inline*, *square*, *tight*,
|
|
||||||
*behind*, or *infront*
|
|
||||||
|
|
||||||
Watermarks
|
Watermarks
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
|
@ -485,19 +383,19 @@ Checkbox elements can be added to sections or table cells by using
|
||||||
Textboxes
|
Textboxes
|
||||||
---------
|
---------
|
||||||
|
|
||||||
To be completed
|
To be completed.
|
||||||
|
|
||||||
Fields
|
Fields
|
||||||
------
|
------
|
||||||
|
|
||||||
To be completed
|
To be completed.
|
||||||
|
|
||||||
Lines
|
Lines
|
||||||
-----
|
-----
|
||||||
|
|
||||||
To be completed
|
To be completed.
|
||||||
|
|
||||||
Shapes
|
Shapes
|
||||||
------
|
------
|
||||||
|
|
||||||
To be completed
|
To be completed.
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,11 @@ Format (RTF).
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
intro
|
intro
|
||||||
setup
|
installing
|
||||||
general
|
general
|
||||||
containers
|
containers
|
||||||
elements
|
elements
|
||||||
|
styles
|
||||||
templates
|
templates
|
||||||
writersreaders
|
writersreaders
|
||||||
recipes
|
recipes
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ Don't forget to change `code::` directive to `code-block::` in the resulting rst
|
||||||
- [Fields](#fields)
|
- [Fields](#fields)
|
||||||
- [Lines](#lines)
|
- [Lines](#lines)
|
||||||
- [Shapes](#shapes)
|
- [Shapes](#shapes)
|
||||||
|
- [Styles](#styles)
|
||||||
|
- [Section](#section)
|
||||||
|
- [Font](#font)
|
||||||
|
- [Paragraph](#paragraph)
|
||||||
|
- [Table](#table)
|
||||||
- [Templates](#templates)
|
- [Templates](#templates)
|
||||||
- [Writers & readers](#writers-readers)
|
- [Writers & readers](#writers-readers)
|
||||||
- [OOXML](#ooxml)
|
- [OOXML](#ooxml)
|
||||||
|
|
@ -320,47 +325,19 @@ Containers are objects where you can put elements (texts, lists, tables, etc). T
|
||||||
Every visible element in word is placed inside of a section. To create a section, use the following code:
|
Every visible element in word is placed inside of a section. To create a section, use the following code:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$section = $phpWord->addSection($sectionSettings);
|
$section = $phpWord->addSection($sectionStyle);
|
||||||
```
|
```
|
||||||
|
|
||||||
The `$sectionSettings` is an optional associative array that sets the section. Example:
|
The `$sectionStyle` is an optional associative array that sets the section. Example:
|
||||||
|
|
||||||
```php
|
```php
|
||||||
$sectionSettings = array(
|
$sectionStyle = array(
|
||||||
'orientation' => 'landscape',
|
'orientation' => 'landscape',
|
||||||
'marginTop' => 600,
|
'marginTop' => 600,
|
||||||
'colsNum' => 2,
|
'colsNum' => 2,
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Section style
|
|
||||||
|
|
||||||
Below are the available styles for section:
|
|
||||||
|
|
||||||
- `orientation` Page orientation, i.e. 'portrait' (default) or 'landscape'
|
|
||||||
- `marginTop` Page margin top in twips
|
|
||||||
- `marginLeft` Page margin left in twips
|
|
||||||
- `marginRight` Page margin right in twips
|
|
||||||
- `marginBottom` Page margin bottom in twips
|
|
||||||
- `borderTopSize` Border top size in twips
|
|
||||||
- `borderTopColor` Border top color
|
|
||||||
- `borderLeftSize` Border left size in twips
|
|
||||||
- `borderLeftColor` Border left color
|
|
||||||
- `borderRightSize` Border right size in twips
|
|
||||||
- `borderRightColor` Border right color
|
|
||||||
- `borderBottomSize` Border bottom size in twips
|
|
||||||
- `borderBottomColor` Border bottom color
|
|
||||||
- `headerHeight` Spacing to top of header
|
|
||||||
- `footerHeight` Spacing to bottom of footer
|
|
||||||
- `gutter` Page gutter spacing
|
|
||||||
- `colsNum` Number of columns
|
|
||||||
- `colsSpace` Spacing between columns
|
|
||||||
- `breakType` Section break type (nextPage, nextColumn, continuous, evenPage, oddPage)
|
|
||||||
|
|
||||||
The following two styles are automatically set by the use of the `orientation` style. You can alter them but that's not recommended.
|
|
||||||
|
|
||||||
- `pageSizeW` Page width in twips
|
|
||||||
- `pageSizeH` Page height in twips
|
|
||||||
|
|
||||||
### Page number
|
### Page number
|
||||||
|
|
||||||
|
|
@ -485,8 +462,6 @@ $section->addText($text, [$fontStyle], [$paragraphStyle]);
|
||||||
$textrun = $section->addTextRun([$paragraphStyle]);
|
$textrun = $section->addTextRun([$paragraphStyle]);
|
||||||
```
|
```
|
||||||
|
|
||||||
### Text styles
|
|
||||||
|
|
||||||
You can use the `$fontStyle` and `$paragraphStyle` variable to define text formatting. There are 2 options to style the inserted text elements, i.e. inline style by using array or defined style by adding style definition.
|
You can use the `$fontStyle` and `$paragraphStyle` variable to define text formatting. There are 2 options to style the inserted text elements, i.e. inline style by using array or defined style by adding style definition.
|
||||||
|
|
||||||
Inline style examples:
|
Inline style examples:
|
||||||
|
|
@ -514,44 +489,6 @@ $phpWord->addParagraphStyle('pStyle', $paragraphStyle);
|
||||||
$text = $section->addText('Hello world!', 'pStyle');
|
$text = $section->addText('Hello world!', 'pStyle');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Font style
|
|
||||||
|
|
||||||
Available font styles:
|
|
||||||
|
|
||||||
- `name` Font name, e.g. *Arial*
|
|
||||||
- `size` Font size, e.g. *20*, *22*,
|
|
||||||
- `hint` Font content type, *default*, *eastAsia*, or *cs*
|
|
||||||
- `bold` Bold, *true* or *false*
|
|
||||||
- `italic` Italic, *true* or *false*
|
|
||||||
- `superScript` Superscript, *true* or *false*
|
|
||||||
- `subScript` Subscript, *true* or *false*
|
|
||||||
- `underline` Underline, *dash*, *dotted*, etc.
|
|
||||||
- `strikethrough` Strikethrough, *true* or *false*
|
|
||||||
- `doubleStrikethrough` Double strikethrough, *true* or *false*
|
|
||||||
- `color` Font color, e.g. *FF0000*
|
|
||||||
- `fgColor` Font highlight color, e.g. *yellow*, *green*, *blue*
|
|
||||||
- `bgColor` Font background color, e.g. *FF0000*
|
|
||||||
- `smallCaps` Small caps, *true* or *false*
|
|
||||||
- `allCaps` All caps, *true* or *false*
|
|
||||||
|
|
||||||
#### Paragraph style
|
|
||||||
|
|
||||||
Available paragraph styles:
|
|
||||||
|
|
||||||
- `align` Paragraph alignment, *left*, *right* or *center*
|
|
||||||
- `spaceBefore` Space before paragraph
|
|
||||||
- `spaceAfter` Space after paragraph
|
|
||||||
- `indent` Indent by how much
|
|
||||||
- `hanging` Hanging by how much
|
|
||||||
- `basedOn` Parent style
|
|
||||||
- `next` Style for next paragraph
|
|
||||||
- `widowControl` Allow first/last line to display on a separate page, *true* or *false*
|
|
||||||
- `keepNext` Keep paragraph with next paragraph, *true* or *false*
|
|
||||||
- `keepLines` Keep all lines on one page, *true* or *false*
|
|
||||||
- `pageBreakBefore` Start paragraph on next page, *true* or *false*
|
|
||||||
- `lineHeight` text line height, e.g. *1.0*, *1.5*, ect...
|
|
||||||
- `tabs` Set of custom tab stops
|
|
||||||
|
|
||||||
### Titles
|
### Titles
|
||||||
|
|
||||||
If you want to structure your document or build table of contents, you need titles or headings. To add a title to the document, use the `addTitleStyle` and `addTitle` method.
|
If you want to structure your document or build table of contents, you need titles or headings. To add a title to the document, use the `addTitleStyle` and `addTitle` method.
|
||||||
|
|
@ -602,9 +539,9 @@ $section->addTextBreak([$breakCount], [$fontStyle], [$paragraphStyle]);
|
||||||
|
|
||||||
There are two ways to insert a page breaks, using the `addPageBreak` method or using the `pageBreakBefore` style of paragraph.
|
There are two ways to insert a page breaks, using the `addPageBreak` method or using the `pageBreakBefore` style of paragraph.
|
||||||
|
|
||||||
:: code-block:: php
|
```php
|
||||||
|
$section->addPageBreak();
|
||||||
> \$section-\>addPageBreak();
|
```
|
||||||
|
|
||||||
## Lists
|
## Lists
|
||||||
|
|
||||||
|
|
@ -643,20 +580,6 @@ $section->addListItem('List Item I.b', 1, null, 'multilevel');
|
||||||
$section->addListItem('List Item II', 0, null, 'multilevel');
|
$section->addListItem('List Item II', 0, null, 'multilevel');
|
||||||
```
|
```
|
||||||
|
|
||||||
Level styles:
|
|
||||||
|
|
||||||
- `start` Starting value
|
|
||||||
- `format` Numbering format bullet|decimal|upperRoman|lowerRoman|upperLetter|lowerLetter
|
|
||||||
- `restart` Restart numbering level symbol
|
|
||||||
- `suffix` Content between numbering symbol and paragraph text tab|space|nothing
|
|
||||||
- `text` Numbering level text e.g. %1 for nonbullet or bullet character
|
|
||||||
- `align` Numbering symbol align left|center|right|both
|
|
||||||
- `left` See paragraph style
|
|
||||||
- `hanging` See paragraph style
|
|
||||||
- `tabPos` See paragraph style
|
|
||||||
- `font` Font name
|
|
||||||
- `hint` See font style
|
|
||||||
|
|
||||||
## Tables
|
## Tables
|
||||||
|
|
||||||
To add tables, rows, and cells, use the `addTable`, `addRow`, and `addCell` methods:
|
To add tables, rows, and cells, use the `addTable`, `addRow`, and `addCell` methods:
|
||||||
|
|
@ -680,33 +603,6 @@ $phpWord->addTableStyle('myTable', $tableStyle, $firstRowStyle);
|
||||||
$table = $section->addTable('myTable');
|
$table = $section->addTable('myTable');
|
||||||
```
|
```
|
||||||
|
|
||||||
### Table, row, and cell styles
|
|
||||||
|
|
||||||
Table styles:
|
|
||||||
|
|
||||||
- `width` Table width in percent
|
|
||||||
- `bgColor` Background color, e.g. '9966CC'
|
|
||||||
- `border(Top|Right|Bottom|Left)Size` Border size in twips
|
|
||||||
- `border(Top|Right|Bottom|Left)Color` Border color, e.g. '9966CC'
|
|
||||||
- `cellMargin(Top|Right|Bottom|Left)` Cell margin in twips
|
|
||||||
|
|
||||||
Row styles:
|
|
||||||
|
|
||||||
- `tblHeader` Repeat table row on every new page, *true* or *false*
|
|
||||||
- `cantSplit` Table row cannot break across pages, *true* or *false*
|
|
||||||
- `exactHeight` Row height is exact or at least
|
|
||||||
|
|
||||||
Cell styles:
|
|
||||||
|
|
||||||
- `width` Cell width in twips
|
|
||||||
- `valign` Vertical alignment, *top*, *center*, *both*, *bottom*
|
|
||||||
- `textDirection` Direction of text
|
|
||||||
- `bgColor` Background color, e.g. '9966CC'
|
|
||||||
- `border(Top|Right|Bottom|Left)Size` Border size in twips
|
|
||||||
- `border(Top|Right|Bottom|Left)Color` Border color, e.g. '9966CC'
|
|
||||||
- `gridSpan` Number of columns spanned
|
|
||||||
- `vMerge` *restart* or *continue*
|
|
||||||
|
|
||||||
### Cell span
|
### Cell span
|
||||||
|
|
||||||
You can span a cell on multiple columns by using `gridSpan` or multiple rows by using `vMerge`.
|
You can span a cell on multiple columns by using `gridSpan` or multiple rows by using `vMerge`.
|
||||||
|
|
@ -749,17 +645,6 @@ $textrun = $section->addTextRun();
|
||||||
$textrun->addImage('http://php.net/logo.jpg');
|
$textrun->addImage('http://php.net/logo.jpg');
|
||||||
```
|
```
|
||||||
|
|
||||||
### Image styles
|
|
||||||
|
|
||||||
Available image styles:
|
|
||||||
|
|
||||||
- `width` Width in pixels
|
|
||||||
- `height` Height in pixels
|
|
||||||
- `align` Image alignment, *left*, *right*, or *center*
|
|
||||||
- `marginTop` Top margin in inches, can be negative
|
|
||||||
- `marginLeft` Left margin in inches, can be negative
|
|
||||||
- `wrappingStyle` Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*
|
|
||||||
|
|
||||||
### Watermarks
|
### Watermarks
|
||||||
|
|
||||||
To add a watermark (or page background image), your section needs a header reference. After creating a header, you can use the `addWatermark` method to add a watermark.
|
To add a watermark (or page background image), your section needs a header reference. After creating a header, you can use the `addWatermark` method to add a watermark.
|
||||||
|
|
@ -856,6 +741,127 @@ To be completed.
|
||||||
|
|
||||||
To be completed.
|
To be completed.
|
||||||
|
|
||||||
|
# Styles
|
||||||
|
|
||||||
|
## Section
|
||||||
|
|
||||||
|
Below are the available styles for section:
|
||||||
|
|
||||||
|
- `orientation` Page orientation, i.e. 'portrait' (default) or 'landscape'
|
||||||
|
- `marginTop` Page margin top in twips
|
||||||
|
- `marginLeft` Page margin left in twips
|
||||||
|
- `marginRight` Page margin right in twips
|
||||||
|
- `marginBottom` Page margin bottom in twips
|
||||||
|
- `borderTopSize` Border top size in twips
|
||||||
|
- `borderTopColor` Border top color
|
||||||
|
- `borderLeftSize` Border left size in twips
|
||||||
|
- `borderLeftColor` Border left color
|
||||||
|
- `borderRightSize` Border right size in twips
|
||||||
|
- `borderRightColor` Border right color
|
||||||
|
- `borderBottomSize` Border bottom size in twips
|
||||||
|
- `borderBottomColor` Border bottom color
|
||||||
|
- `headerHeight` Spacing to top of header
|
||||||
|
- `footerHeight` Spacing to bottom of footer
|
||||||
|
- `gutter` Page gutter spacing
|
||||||
|
- `colsNum` Number of columns
|
||||||
|
- `colsSpace` Spacing between columns
|
||||||
|
- `breakType` Section break type (nextPage, nextColumn, continuous, evenPage, oddPage)
|
||||||
|
|
||||||
|
The following two styles are automatically set by the use of the `orientation` style. You can alter them but that's not recommended.
|
||||||
|
|
||||||
|
- `pageSizeW` Page width in twips
|
||||||
|
- `pageSizeH` Page height in twips
|
||||||
|
|
||||||
|
## Font
|
||||||
|
|
||||||
|
Available font styles:
|
||||||
|
|
||||||
|
- `name` Font name, e.g. *Arial*
|
||||||
|
- `size` Font size, e.g. *20*, *22*,
|
||||||
|
- `hint` Font content type, *default*, *eastAsia*, or *cs*
|
||||||
|
- `bold` Bold, *true* or *false*
|
||||||
|
- `italic` Italic, *true* or *false*
|
||||||
|
- `superScript` Superscript, *true* or *false*
|
||||||
|
- `subScript` Subscript, *true* or *false*
|
||||||
|
- `underline` Underline, *dash*, *dotted*, etc.
|
||||||
|
- `strikethrough` Strikethrough, *true* or *false*
|
||||||
|
- `doubleStrikethrough` Double strikethrough, *true* or *false*
|
||||||
|
- `color` Font color, e.g. *FF0000*
|
||||||
|
- `fgColor` Font highlight color, e.g. *yellow*, *green*, *blue*
|
||||||
|
- `bgColor` Font background color, e.g. *FF0000*
|
||||||
|
- `smallCaps` Small caps, *true* or *false*
|
||||||
|
- `allCaps` All caps, *true* or *false*
|
||||||
|
|
||||||
|
## Paragraph
|
||||||
|
|
||||||
|
Available paragraph styles:
|
||||||
|
|
||||||
|
- `align` Paragraph alignment, *left*, *right* or *center*
|
||||||
|
- `spaceBefore` Space before paragraph
|
||||||
|
- `spaceAfter` Space after paragraph
|
||||||
|
- `indent` Indent by how much
|
||||||
|
- `hanging` Hanging by how much
|
||||||
|
- `basedOn` Parent style
|
||||||
|
- `next` Style for next paragraph
|
||||||
|
- `widowControl` Allow first/last line to display on a separate page, *true* or *false*
|
||||||
|
- `keepNext` Keep paragraph with next paragraph, *true* or *false*
|
||||||
|
- `keepLines` Keep all lines on one page, *true* or *false*
|
||||||
|
- `pageBreakBefore` Start paragraph on next page, *true* or *false*
|
||||||
|
- `lineHeight` text line height, e.g. *1.0*, *1.5*, ect...
|
||||||
|
- `tabs` Set of custom tab stops
|
||||||
|
|
||||||
|
## Table
|
||||||
|
|
||||||
|
Table styles:
|
||||||
|
|
||||||
|
- `width` Table width in percent
|
||||||
|
- `bgColor` Background color, e.g. '9966CC'
|
||||||
|
- `border(Top|Right|Bottom|Left)Size` Border size in twips
|
||||||
|
- `border(Top|Right|Bottom|Left)Color` Border color, e.g. '9966CC'
|
||||||
|
- `cellMargin(Top|Right|Bottom|Left)` Cell margin in twips
|
||||||
|
|
||||||
|
Row styles:
|
||||||
|
|
||||||
|
- `tblHeader` Repeat table row on every new page, *true* or *false*
|
||||||
|
- `cantSplit` Table row cannot break across pages, *true* or *false*
|
||||||
|
- `exactHeight` Row height is exact or at least
|
||||||
|
|
||||||
|
Cell styles:
|
||||||
|
|
||||||
|
- `width` Cell width in twips
|
||||||
|
- `valign` Vertical alignment, *top*, *center*, *both*, *bottom*
|
||||||
|
- `textDirection` Direction of text
|
||||||
|
- `bgColor` Background color, e.g. '9966CC'
|
||||||
|
- `border(Top|Right|Bottom|Left)Size` Border size in twips
|
||||||
|
- `border(Top|Right|Bottom|Left)Color` Border color, e.g. '9966CC'
|
||||||
|
- `gridSpan` Number of columns spanned
|
||||||
|
- `vMerge` *restart* or *continue*
|
||||||
|
|
||||||
|
## Image
|
||||||
|
|
||||||
|
Available image styles:
|
||||||
|
|
||||||
|
- `width` Width in pixels
|
||||||
|
- `height` Height in pixels
|
||||||
|
- `align` Image alignment, *left*, *right*, or *center*
|
||||||
|
- `marginTop` Top margin in inches, can be negative
|
||||||
|
- `marginLeft` Left margin in inches, can be negative
|
||||||
|
- `wrappingStyle` Wrapping style, *inline*, *square*, *tight*, *behind*, or *infront*
|
||||||
|
|
||||||
|
## Numbering level
|
||||||
|
|
||||||
|
- `start` Starting value
|
||||||
|
- `format` Numbering format bullet|decimal|upperRoman|lowerRoman|upperLetter|lowerLetter
|
||||||
|
- `restart` Restart numbering level symbol
|
||||||
|
- `suffix` Content between numbering symbol and paragraph text tab|space|nothing
|
||||||
|
- `text` Numbering level text e.g. %1 for nonbullet or bullet character
|
||||||
|
- `align` Numbering symbol align left|center|right|both
|
||||||
|
- `left` See paragraph style
|
||||||
|
- `hanging` See paragraph style
|
||||||
|
- `tabPos` See paragraph style
|
||||||
|
- `font` Font name
|
||||||
|
- `hint` See font style
|
||||||
|
|
||||||
# Templates
|
# Templates
|
||||||
|
|
||||||
You can create a docx template with included search-patterns that can be 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 a loaded template file.
|
You can create a docx template with included search-patterns that can be 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 a loaded template file.
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,137 @@
|
||||||
|
.. _styles:
|
||||||
|
|
||||||
|
Styles
|
||||||
|
======
|
||||||
|
|
||||||
|
Section
|
||||||
|
-------
|
||||||
|
|
||||||
|
Below are the available styles for section:
|
||||||
|
|
||||||
|
- ``orientation`` Page orientation, i.e. 'portrait' (default) or
|
||||||
|
'landscape'
|
||||||
|
- ``marginTop`` Page margin top in twips
|
||||||
|
- ``marginLeft`` Page margin left in twips
|
||||||
|
- ``marginRight`` Page margin right in twips
|
||||||
|
- ``marginBottom`` Page margin bottom in twips
|
||||||
|
- ``borderTopSize`` Border top size in twips
|
||||||
|
- ``borderTopColor`` Border top color
|
||||||
|
- ``borderLeftSize`` Border left size in twips
|
||||||
|
- ``borderLeftColor`` Border left color
|
||||||
|
- ``borderRightSize`` Border right size in twips
|
||||||
|
- ``borderRightColor`` Border right color
|
||||||
|
- ``borderBottomSize`` Border bottom size in twips
|
||||||
|
- ``borderBottomColor`` Border bottom color
|
||||||
|
- ``headerHeight`` Spacing to top of header
|
||||||
|
- ``footerHeight`` Spacing to bottom of footer
|
||||||
|
- ``gutter`` Page gutter spacing
|
||||||
|
- ``colsNum`` Number of columns
|
||||||
|
- ``colsSpace`` Spacing between columns
|
||||||
|
- ``breakType`` Section break type (nextPage, nextColumn, continuous,
|
||||||
|
evenPage, oddPage)
|
||||||
|
|
||||||
|
The following two styles are automatically set by the use of the
|
||||||
|
``orientation`` style. You can alter them but that's not recommended.
|
||||||
|
|
||||||
|
- ``pageSizeW`` Page width in twips
|
||||||
|
- ``pageSizeH`` Page height in twips
|
||||||
|
|
||||||
|
Font
|
||||||
|
----
|
||||||
|
|
||||||
|
Available font styles:
|
||||||
|
|
||||||
|
- ``name`` Font name, e.g. *Arial*
|
||||||
|
- ``size`` Font size, e.g. *20*, *22*,
|
||||||
|
- ``hint`` Font content type, *default*, *eastAsia*, or *cs*
|
||||||
|
- ``bold`` Bold, *true* or *false*
|
||||||
|
- ``italic`` Italic, *true* or *false*
|
||||||
|
- ``superScript`` Superscript, *true* or *false*
|
||||||
|
- ``subScript`` Subscript, *true* or *false*
|
||||||
|
- ``underline`` Underline, *dash*, *dotted*, etc.
|
||||||
|
- ``strikethrough`` Strikethrough, *true* or *false*
|
||||||
|
- ``doubleStrikethrough`` Double strikethrough, *true* or *false*
|
||||||
|
- ``color`` Font color, e.g. *FF0000*
|
||||||
|
- ``fgColor`` Font highlight color, e.g. *yellow*, *green*, *blue*
|
||||||
|
- ``bgColor`` Font background color, e.g. *FF0000*
|
||||||
|
- ``smallCaps`` Small caps, *true* or *false*
|
||||||
|
- ``allCaps`` All caps, *true* or *false*
|
||||||
|
|
||||||
|
Paragraph
|
||||||
|
---------
|
||||||
|
|
||||||
|
Available paragraph styles:
|
||||||
|
|
||||||
|
- ``align`` Paragraph alignment, *left*, *right* or *center*
|
||||||
|
- ``spaceBefore`` Space before paragraph
|
||||||
|
- ``spaceAfter`` Space after paragraph
|
||||||
|
- ``indent`` Indent by how much
|
||||||
|
- ``hanging`` Hanging by how much
|
||||||
|
- ``basedOn`` Parent style
|
||||||
|
- ``next`` Style for next paragraph
|
||||||
|
- ``widowControl`` Allow first/last line to display on a separate page,
|
||||||
|
*true* or *false*
|
||||||
|
- ``keepNext`` Keep paragraph with next paragraph, *true* or *false*
|
||||||
|
- ``keepLines`` Keep all lines on one page, *true* or *false*
|
||||||
|
- ``pageBreakBefore`` Start paragraph on next page, *true* or *false*
|
||||||
|
- ``lineHeight`` text line height, e.g. *1.0*, *1.5*, ect...
|
||||||
|
- ``tabs`` Set of custom tab stops
|
||||||
|
|
||||||
|
Table
|
||||||
|
-----
|
||||||
|
|
||||||
|
Table styles:
|
||||||
|
|
||||||
|
- ``width`` Table width in percent
|
||||||
|
- ``bgColor`` Background color, e.g. '9966CC'
|
||||||
|
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
||||||
|
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
||||||
|
- ``cellMargin(Top|Right|Bottom|Left)`` Cell margin in twips
|
||||||
|
|
||||||
|
Row styles:
|
||||||
|
|
||||||
|
- ``tblHeader`` Repeat table row on every new page, *true* or *false*
|
||||||
|
- ``cantSplit`` Table row cannot break across pages, *true* or *false*
|
||||||
|
- ``exactHeight`` Row height is exact or at least
|
||||||
|
|
||||||
|
Cell styles:
|
||||||
|
|
||||||
|
- ``width`` Cell width in twips
|
||||||
|
- ``valign`` Vertical alignment, *top*, *center*, *both*, *bottom*
|
||||||
|
- ``textDirection`` Direction of text
|
||||||
|
- ``bgColor`` Background color, e.g. '9966CC'
|
||||||
|
- ``border(Top|Right|Bottom|Left)Size`` Border size in twips
|
||||||
|
- ``border(Top|Right|Bottom|Left)Color`` Border color, e.g. '9966CC'
|
||||||
|
- ``gridSpan`` Number of columns spanned
|
||||||
|
- ``vMerge`` *restart* or *continue*
|
||||||
|
|
||||||
|
Image
|
||||||
|
-----
|
||||||
|
|
||||||
|
Available image styles:
|
||||||
|
|
||||||
|
- ``width`` Width in pixels
|
||||||
|
- ``height`` Height in pixels
|
||||||
|
- ``align`` Image alignment, *left*, *right*, or *center*
|
||||||
|
- ``marginTop`` Top margin in inches, can be negative
|
||||||
|
- ``marginLeft`` Left margin in inches, can be negative
|
||||||
|
- ``wrappingStyle`` Wrapping style, *inline*, *square*, *tight*,
|
||||||
|
*behind*, or *infront*
|
||||||
|
|
||||||
|
Numbering level
|
||||||
|
---------------
|
||||||
|
|
||||||
|
- ``start`` Starting value
|
||||||
|
- ``format`` Numbering format
|
||||||
|
bullet\|decimal\|upperRoman\|lowerRoman\|upperLetter\|lowerLetter
|
||||||
|
- ``restart`` Restart numbering level symbol
|
||||||
|
- ``suffix`` Content between numbering symbol and paragraph text
|
||||||
|
tab\|space\|nothing
|
||||||
|
- ``text`` Numbering level text e.g. %1 for nonbullet or bullet
|
||||||
|
character
|
||||||
|
- ``align`` Numbering symbol align left\|center\|right\|both
|
||||||
|
- ``left`` See paragraph style
|
||||||
|
- ``hanging`` See paragraph style
|
||||||
|
- ``tabPos`` See paragraph style
|
||||||
|
- ``font`` Font name
|
||||||
|
- ``hint`` See font style
|
||||||
Loading…
Reference in New Issue