Word Create
Word Create
Section titled “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.
How it works
Section titled “How it works”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 thebodyends without errors, the document is saved topathand closed. If an inner activity fails, the document is closed without saving. - Without
body: returns the session as output; you add content by passing itsession, 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).
Required parameters
Section titled “Required parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Path where the new .docx will be saved. |
Optional parameters
Section titled “Optional parameters”None.
Sub-flows
Section titled “Sub-flows”body optional
Section titled “body optional”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.
Output
Section titled “Output”- Without
body: aZoanWordSessionwith the empty document in memory. Pass it assessionto the building activities. - With
body: this activity does not return a value; the result is the file saved atpath.
Example
Section titled “Example”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 = salesWord to PDF path = "C:/reports/sales_" + today().ToString("yyyyMM") + ".docx" → output: pdfPathCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'path' is required. | path is missing or the expression returned nothing. |
| Access error on save | The 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. |
Related activities
Section titled “Related activities”- Word Append Paragraph / Word Append Table / Word Insert Image — add content.
- Word Open — open an existing document.