addSection

addSection

TRIAL / ADVANCED / PREMIUM

Inserts a new section into the Word document.

Description
public addSection ( string $sectionType [, string $paperType [, array $options ] ] ] )

This method allows the creation of new sections in your Word document.

This option is needed if you wish to change the page properties, for example, from portrait to landscape orientation in part of your Word document.

All content inserted after a call to this method will be incorporated into the new section.

Parameters

sectionType

These parameters determine the kind of break (if any) used. The possible values are:

  • nextPage (default value): the new section starts in a new page
  • nextColumn: the new section starts in the following column
  • continuous: there is no break between sections
  • evenPage: the new section starts in the next available even page
  • oddPage: the new section starts in the next available odd page

paperType

The type of paper to be used. The possible values are:

  • A4
  • A3
  • letter
  • legal
  • A4-landscape
  • letter-landscape
  • legal-landscape
  • custom

options

This parameter is only required if the paperType parameter has been set up to custom.

Key Type Description
height int Section height in twips.
width int Section width in twips (twentieths of a point).
marginTop int Top margin for this section in twips.
marginRight int Right margin for this section in twips.
marginBottom int Bottom margin for this section in twips.
marginLeft int Left margin for this section in twips.
marginHeader int Header margin in twips.
marginFooter int Footer margin in twips.
numberCols int Number of columns for this section.
orient string Section page orientation (portrait or landscape).
gutter int Gutter in twips (used for binding).
bidi bool Set to true for right to left languages (default value is false).
rtl bool Set to true for right to left languages (default value is false).
pageNumberType array Keys and values:
  • fmt => number format (cardinalText, decimal, decimalEnclosedCircle, decimalEnclosedFullstop, decimalEnclosedParen, decimalZero, lowerLetter, lowerRoman, none, ordinalText, upperLetter, upperRoman)
  • start => page number
columns array Keys and values:
  • width (int)
  • space (int)
endnotes array Keys and values:
  • numFmt (string) => numbering format: decimal, upperRoman, lowerRoman, upperLetter...
  • numRestart (string) => continuous, eachSect, eachPage
  • numStart (int) => starting value
  • pos (string) => sectEnd, docEnd
footnotes array Keys and values:
  • numFmt (string) => numbering format: decimal, upperRoman, lowerRoman, upperLetter...
  • numRestart (string) => continuous, eachSect, eachPage
  • numStart (int) => starting value
  • pos (string) => sectEnd, docEnd
Code samples

Example #1