Skip to content

Word Create

Type: word-create  ·  Package: Word Activities v1.0.4  ·  Output: ZoanWordSession

Creates a new, empty .docx document and returns a session to fill it with paragraphs, tables and images. It is the starting point for generating documents from the robot: letters, reports, minutes, contracts.

Creates the document in memory; path is where it will be saved. The file is not written to disk until it is saved. Two modes:

  • With body (recommended): you add the content inside the sub-flow and, when the body ends without errors, the document is saved to path and closed. If an inner activity fails, the document is closed without saving.
  • Without body: returns the session as output; you add content by passing it session, and at the end you save with Word Save and close with Word Close.

On save, missing folders are created and an existing file with the same name is overwritten. The new document has no style definitions; if you need headings with your own format, start from a template with Word Open (see paragraph styles).

ParameterTypeDefaultDescription
pathstring—Path where the new .docx will be saved.

None.

Activities that build the document. They inherit the session; when they finish without errors, the document is saved and closed by itself. If omitted (or left empty), the activity returns the session as output.

  • Without body: a ZoanWordSession with the empty document in memory. Pass it as session to the building activities.
  • With body: this activity does not return a value; the result is the file saved at path.

Generate a report with a title, text and a table, and convert it to PDF:

Word Create path = "C:/reports/sales_" + today().ToString("yyyyMM") + ".docx"
└─ body:
Word Append Paragraph text = "Sales Report" style = Title
Word Append Paragraph text = "Generated on " + today().ToString("yyyy-MM-dd")
Word Append Paragraph text = "Detail" style = Heading1
Word Append Table table = sales
Word to PDF path = "C:/reports/sales_" + today().ToString("yyyyMM") + ".docx" → output: pdfPath
MessageCause and fix
'path' is required.path is missing or the expression returned nothing.
Access error on saveThe path is not valid, there is no write permission, or the file is open in another program. It happens when saving (at the end of the body or in Word Save), not when creating.