@@ -34,8 +34,10 @@ the following lines to your ``composer.json``.
34
34
### Table of contents
35
35
36
36
1 . [ Basic usage] ( #basic-usage )
37
+ * [ Measurement units] ( #measurement-units )
37
38
2 . [ Sections] ( #sections )
38
- * [ Change Section Page Numbering] ( #sections-page-numbering )
39
+ * [ Section settings] ( #section-settings )
40
+ * [ Section page numbering] ( #section-page-numbering )
39
41
3 . [ Tables] ( #tables )
40
42
* [ Cell Style] ( #tables-cell-style )
41
43
4 . [ Images] ( #images )
@@ -75,6 +77,7 @@ $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
75
77
$objWriter->save('helloWorld.docx');
76
78
```
77
79
80
+ <a name =" measurement-units " ></a >
78
81
##### Measurement units
79
82
80
83
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));
98
101
<a name =" sections " ></a >
99
102
#### Sections
100
103
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
103
149
104
150
You can change a section page numbering.
105
151
0 commit comments