Add section settings documentation
This commit is contained in:
parent
b39f9daee2
commit
074dfabbba
52
README.md
52
README.md
|
|
@ -34,8 +34,10 @@ the following lines to your ``composer.json``.
|
|||
### Table of contents
|
||||
|
||||
1. [Basic usage](#basic-usage)
|
||||
* [Measurement units](#measurement-units)
|
||||
2. [Sections](#sections)
|
||||
* [Change Section Page Numbering](#sections-page-numbering)
|
||||
* [Section settings](#section-settings)
|
||||
* [Section page numbering](#section-page-numbering)
|
||||
3. [Tables](#tables)
|
||||
* [Cell Style](#tables-cell-style)
|
||||
4. [Images](#images)
|
||||
|
|
@ -75,6 +77,7 @@ $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
|||
$objWriter->save('helloWorld.docx');
|
||||
```
|
||||
|
||||
<a name="measurement-units"></a>
|
||||
##### 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.
|
||||
|
|
@ -98,8 +101,51 @@ $sectionStyle->setMarginRight(PHPWord_Shared_Font::centimeterSizeToTwips(2));
|
|||
<a name="sections"></a>
|
||||
#### Sections
|
||||
|
||||
<a name="sections-page-numbering"></a>
|
||||
##### Change Section Page Numbering
|
||||
Every visible element in word is placed inside of a section. To create a section, use the following code:
|
||||
|
||||
```php
|
||||
$section = $PHPWord->createSection($sectionSettings);
|
||||
```
|
||||
The `$sectionSettings` is an optional associative array that sets the section. Example:
|
||||
|
||||
```php
|
||||
$sectionSettings = array(
|
||||
'orientation' => 'landscape',
|
||||
'marginTop' => 600,
|
||||
'colsNum' => 2,
|
||||
);
|
||||
```
|
||||
<a name="section-settings"></a>
|
||||
##### Section settings
|
||||
|
||||
Below are the available settings 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
|
||||
* `colsNum` Number of columns
|
||||
* `colsSpace` Spacing between columns
|
||||
* `breakType` Section break type (nextPage, nextColumn, continuous, evenPage, oddPage)
|
||||
|
||||
The following two settings are automatically set by the use of the `orientation` setting. You can alter them but that's not recommended.
|
||||
|
||||
* `pageSizeW` Page width in twips
|
||||
* `pageSizeH` Page height in twips
|
||||
|
||||
<a name="section-page-numbering"></a>
|
||||
##### Section page numbering
|
||||
|
||||
You can change a section page numbering.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue