addSection

addSection

BASIC / ADVANCED / PREMIUM

Inserts a new section into the Word document.

Description
public void addSection()
public void addSection(String sectionType)
public void addSection(String sectionType, String paperType)

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.

Option Type Description
width Integer Section width in twips (twentieths of a point).
height Integer Section height in twips.
numberCols Integer Number of columns for this section.
orient String Section page orientation (portrait or landscape).
marginTop Integer Top margin for this section in twips.
marginRight Integer Right margin for this section in twips.
marginBottom Integer Bottom margin for this section in twips.
marginLeft Integer Left margin for this section in twips.
marginHeader Integer Header margin in twips.
marginFooter Integer Footer margin in twips.
gutter Integer Gutter in twips (used for binding).
bidi Boolean Set to true for right to left languages.
rtl Boolean Set to true for right to left languages.
rtlGutter Integer RTL Gutter in twips (used for binding).
Code samples

Example #1