Word Read Paragraphs
Word Read Paragraphs
Section titled “Word Read Paragraphs”Type: word-read-paragraphs · Package: Word Activities v1.0.4 · Output: List<object>
Reads all the paragraphs of a document and returns them as a list of strings (one per paragraph). Useful when you want to process the document paragraph by paragraph instead of as a single block of text.
How it works
Section titled “How it works”Goes through the paragraphs of the document body, in order, and returns the full text of each one. By default it skips empty paragraphs (includeEmpty = false). It accepts session or path — see the two modes; with path it opens the file, reads it and closes it without changes.
- Scope: only the body paragraphs. Text inside tables is not included (read it with Word Read Tables), nor headers or footers.
- A paragraph that only has spaces is not considered empty and is included.
includeEmptyis set in the editor; it does not accept expressions.
Required parameters
Section titled “Required parameters”None — but you must provide session or path.
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanWordSession | — | Session from Word Open (instead of path). Inherited automatically inside a body. |
path | string | — | Path to the .docx (quick mode). Only used when there is no session. |
includeEmpty | bool | false | Include empty paragraphs (useful if you need to keep each paragraph’s position). |
Output
Section titled “Output”Returns a List of strings (string), one item per paragraph in document order. A document with no paragraphs with text returns an empty list. Loop over it with For Each.
Example
Section titled “Example”Word Read Paragraphs path = asset("minutes.docx") → output: paragraphsFor Each items = paragraphs itemVariable = p └─ activities: If condition = startsWith(str(p), "RESOLUTION") └─ then: Log message = pCommon errors
Section titled “Common errors”| Message | Cause and fix |
|---|---|
'session' or 'path' is required. | There is no session and no path. |
File not found. | The path does not exist on the robot’s machine. |
Related activities
Section titled “Related activities”- Word Read Text — all the text in one string.
- Word Read Tables — extract the tables.