Skip to content

Documentor Render a Word template

Replace double-curly-braced placeholders with values in a Word document.
LabelTypeRequiredDescription
Template URLstringyes

Publicly accessible URL of the base Word document (.docx) to use.

Fragmentsarray_jsonno

Ordered list of public .docx URLs to document fragments to replace the {{DocumentorFragments}} placeholder with. Items can either be a URL or an object with url and values fields, and optionally pictures (an array with objects with placeholder, url, and optionally width or height fields).

ValuesJSONno

JSON key-value mapping of the variable names and the values to replace them with.

Pictureslistno

List of the placeholder names and the pictures to replace them with.

Output formatchoiceyes

Format of the resulting document.

Choices:

  • .docx (Microsoft Word)
  • .pdf (Portable Document Format)
Remove metadatabooleanno

Whether to remove metadata, such as title and author name, from the resulting PDF document.

The values field is an object mapping the placeholder names to the values to replace them with. Each value can either be:

  • a string or number
  • an array, which will be converted to a list
  • an object, whose keys will be converted to level 3 headings with the values printed below

The pictures field is an object mapping the placeholder names to the URLs to the images to replace them with.

The following JSON is returned.

Example output
{
"ok": true,
"outputURL": "https://connector-backend.smartyellow.net/artefacts/8f7f69af-a809-423d-bfae-2f2b78a5ec6c.png",
"warnings": []
}
  • outputURL contains the URL to the generated document. Read more on these URLs here.

  • warnings may contain warnings about pictures you provided:

    • The format “$format” of the picture for “$placeholder” is unknown. Allowed are: jpg, png, gif, bmp.

    • Your provided dimensions for the “$placeholder” image result in an aspect ratio of 1:2.65, which does not match its intrinsic ratio of 1:3. This may result in a stretched image. You can resolve this by only setting a width or height instead of both.