Inserts form elements into the Word document.


Element definition

This method allows to insert form elements of various kinds into your Word document:

  • text fields,
  • check boxes and
  • select fields.

If one wishes to insert a form element within a complex paragraph one should use this method in combination with the addText method.

Attributes and sub-elements


Possible values are:

  • textfield
  • checkbox
  • select


Specific options for form elements:

key Description
defaultValue A string of text for the textfield type, a boolean value for the checkbox type or an integer representing the index (0 based) for the options of a select form element.
selectOptions An array of options for the dropdown menu.


key Description
pStyle Word style to be used. Run parseStyles() method to check all available paragraph styles
bidi Set to true for right to left languages (default value is false).
bold Bold text: true or false
rtl Set to true for right to left languages (default value is false).
color Hexadecimal color value: 'FF0000', '000000'...
contextualSpacing Set to true for right to left languages (default value is false).
font Font family: 'Arial', Calibri'...
italic Italics: 'on' or 'off'
indentLeft Left margin in points
indentRight Left margin in points
textAlign Text alignment. Possible values are: 'center', 'right', 'both', 'distribute'
keepLines Keeps (whenever possible) all the current paragraph lines on the same page: 'on' or 'off' (default)
keepNext Keeps (whenever possible) in the same page the current paragraph with next paragraph: 'on' or 'off' (default)
lineSpacing Separation between lines: 240 (single spacing), 480 (double spacing and so long so forth.
pageBreakBefore Forces a page break before the paragraph. 'on' or 'off'
spacingBottom Bottom padding in twentieths of a point
spacingTop Left margin in points
fontSize Text size in points: 8, 9, 10...
underline Underline text. Possible values are: 'single', 'words', 'double', 'dotted', 'dash' and 'wave'
widowControl Prevents Word from printing the last line of a paragraph by itself at the top of the page (widow) or the first line of a paragraph at the bottom of a page (orphan): true or false
wordWrap Controls word wrapping: true or false
Code samples
#Example 1




The resulting Word document looks like: