Skip to content

Commit 074dfab

Browse files
committed
Add section settings documentation
1 parent b39f9da commit 074dfab

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

README.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ the following lines to your ``composer.json``.
3434
### Table of contents
3535

3636
1. [Basic usage](#basic-usage)
37+
* [Measurement units](#measurement-units)
3738
2. [Sections](#sections)
38-
* [Change Section Page Numbering](#sections-page-numbering)
39+
* [Section settings](#section-settings)
40+
* [Section page numbering](#section-page-numbering)
3941
3. [Tables](#tables)
4042
* [Cell Style](#tables-cell-style)
4143
4. [Images](#images)
@@ -75,6 +77,7 @@ $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
7577
$objWriter->save('helloWorld.docx');
7678
```
7779

80+
<a name="measurement-units"></a>
7881
##### Measurement units
7982

8083
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));
98101
<a name="sections"></a>
99102
#### Sections
100103

101-
<a name="sections-page-numbering"></a>
102-
##### Change Section Page Numbering
104+
Every visible element in word is placed inside of a section. To create a section, use the following code:
105+
106+
```php
107+
$section = $PHPWord->createSection($sectionSettings);
108+
```
109+
The `$sectionSettings` is an optional associative array that sets the section. Example:
110+
111+
```php
112+
$sectionSettings = array(
113+
'orientation' => 'landscape',
114+
'marginTop' => 600,
115+
'colsNum' => 2,
116+
);
117+
```
118+
<a name="section-settings"></a>
119+
##### Section settings
120+
121+
Below are the available settings for section:
122+
123+
* `orientation` Page orientation, i.e. 'portrait' (default) or 'landscape'
124+
* `marginTop` Page margin top in twips
125+
* `marginLeft` Page margin left in twips
126+
* `marginRight` Page margin right in twips
127+
* `marginBottom` Page margin bottom in twips
128+
* `borderTopSize` Border top size in twips
129+
* `borderTopColor` Border top color
130+
* `borderLeftSize` Border left size in twips
131+
* `borderLeftColor` Border left color
132+
* `borderRightSize` Border right size in twips
133+
* `borderRightColor` Border right color
134+
* `borderBottomSize` Border bottom size in twips
135+
* `borderBottomColor` Border bottom color
136+
* `headerHeight` Spacing to top of header
137+
* `footerHeight` Spacing to bottom of footer
138+
* `colsNum` Number of columns
139+
* `colsSpace` Spacing between columns
140+
* `breakType` Section break type (nextPage, nextColumn, continuous, evenPage, oddPage)
141+
142+
The following two settings are automatically set by the use of the `orientation` setting. You can alter them but that's not recommended.
143+
144+
* `pageSizeW` Page width in twips
145+
* `pageSizeH` Page height in twips
146+
147+
<a name="section-page-numbering"></a>
148+
##### Section page numbering
103149

104150
You can change a section page numbering.
105151

0 commit comments

Comments
 (0)