guideDocument properties

Export to Word converter allows for the configuration of various document properties that affect the appearance and behavior of the Word document.

# Document size

The document size can be specified by selecting one of the predefined values or by setting a custom width and height for the document.

Available document sizes for config.document.size are:

Name Width Height
a3 297 mm 420 mm
a4 210 mm 297 mm
a5 148 mm 210 mm
a6 105 mm 148 mm
b4 250 mm 353 mm
b5 176 mm 250 mm
jb4 257 mm 364 mm
jb5 182 mm 257 mm
letter 8.5 in 11 in
legal 8.5 in 14 in
statement 5.5 in 8.5 in
executive 7.25 in 10.5 in
tabloid 11 in 17 in

Default document size is a4.

To define a custom page size, set config.document.size to an object with width and height properties set to valid length values.

Minimum and maximum accepted length values for config.document.size.width and config.document.size.height :

Unit Minimum value Maximum value
pixels 96 2112
centimeters 2.54 55.88
milimeters 25.4 558.8
inches 1 22

# Document margins

Export To Word converter allows for defining the values of the document margins, including top, bottom, left, and right. The margin values must follow the format of length values.

Minimum and maximum accepted length values for document margins:

Unit Minimum value Maximum value
pixels -2112 2112
centimeters -55.88 55.88
milimeters -558.8 558.8
inches -22 22

Additionally, it is important to note that the sum of the left and right margins should not exceed the width of the document, and the sum of the top and bottom margins should not exceed the height of the document.

Unspecified margins default to 1 inch.

# Document orientation

Document page orientation can be set to either portrait or landscape.

By default, the orientation of the document is inferred from the width and height of the document. If the width is greater than the height, the document orientation is set to landscape; otherwise, it is set to portrait.

Export to Word converter allows for defining the orientation of the document using the config.document.orientation configuration option. When this option is provided, the converter will automatically adjust the width and height of the document to ensure that it is displayed with the desired orientation.

Example of converting a document with a specified orientation:

"config" : {
    "document": {
        "size": {
            "width": "5in",
            "height": "8in"
            },
        "orientation": "landscape"
    }
}

Orientation landscape

# Document language

Export to Word converter allows for defining the language of the document using the config.document.language configuration option. This language setting is used by Word to check spelling and grammar mistakes. The language must be specified as a valid RFC 5652 language tag.

Content language

# Length values

Both page size and page margins can be set to custom length values represented as a string containing a number with an attached unit. These values must adhere to the following format:

  • Numbers must be written in decimal form.
  • The only accepted decimal separator is a period.
  • Accepted units are in, cm, mm, and px.
  • Whitespace between the number and the unit is not allowed.

For example, valid length values include 8.5in, 2.54cm, 25.4mm, and 96px.