Add Text
Adds formatted text to a Word document.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing the node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- In File Descriptor - Unique identifier of the document to add text to. This comes from the Create Word or Open Word node. Default variable is
{{$message.word_fd}}. - Text - Text content to add to the document. Can be a single line or multiple lines using
\nfor line breaks. - Font Size - Font size in points. Default is 12. Common sizes: 10 (small), 12 (normal), 14 (large), 16 (heading).
- Space After - Space after the paragraph in points. Default is 0. Use values like 6, 12, or 18 for spacing between paragraphs.
- Font Name - Font family name. Default is "Times New Roman". Common fonts: Arial, Calibri, Times New Roman, Courier New.
How It Works
The Add Text node appends a new paragraph with formatted text to the Word document. When executed, the node:
- Validates the file descriptor and input parameters
- Retrieves the document from memory using the file descriptor
- Creates a new paragraph at the end of the document
- Applies the specified font name and size to the text
- Sets the paragraph spacing after the text
- Adds the text to the document
Requirements
- Valid file descriptor from Create Word or Open Word node
- Non-empty text content
- Positive font size value
- Non-negative space after value
- Valid font name (font must be available on the system)
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid file descriptor
- Document not found for the given file descriptor
- Empty text content
- Invalid font size (zero or negative)
- Invalid space after value (negative)
- Empty font name
Usage Examples
Example 1: Add Simple Paragraph
Scenario: Add a title to a document
// Add a title with large font
Configuration:
- In File Descriptor:
{{$message.word_fd}} - Text:
Annual Sales Report 2025 - Font Size:
18 - Space After:
12 - Font Name:
Arial
Example 2: Add Multiple Paragraphs
Scenario: Add body text with proper spacing
// Add introduction paragraph
First Add Text Node:
- In File Descriptor:
{{$message.word_fd}} - Text:
This report provides a comprehensive overview of our sales performance for the fiscal year 2025. - Font Size:
12 - Space After:
6 - Font Name:
Calibri
Second Add Text Node:
- In File Descriptor:
{{$message.word_fd}} - Text:
Key highlights include a 25% increase in revenue and expansion into three new markets. - Font Size:
12 - Space After:
12 - Font Name:
Calibri
Example 3: Dynamic Text from Variables
Scenario: Add customer information from variables
// Set customer data
$local.customerName = "Acme Corporation";
$local.contractDate = "January 15, 2025";
$local.contractText = "This agreement is between " + $local.customerName +
" and our company, dated " + $local.contractDate + ".";
Configuration:
- In File Descriptor:
{{$message.word_fd}} - Text:
{{$local.contractText}} - Font Size:
11 - Space After:
0 - Font Name:
Times New Roman
Usage Notes
- Text is always added at the end of the document
- Each Add Text node creates a new paragraph
- Line breaks in text (
\n) are preserved - Font must be installed on the system where the robot runs
- Text formatting is applied to the entire paragraph
- Multiple Add Text nodes can be chained to build the document progressively
Tips for Effective Use
- Consistent Formatting: Use the same font and size for similar content types
- Heading Hierarchy: Use larger font sizes (16-18pt) for titles, medium (14pt) for headings, standard (12pt) for body
- Spacing: Add space after paragraphs (6-12pt) for better readability
- Font Selection:
- Use serif fonts (Times New Roman, Georgia) for formal documents
- Use sans-serif fonts (Arial, Calibri) for modern, clean look
- Variable Content: Store dynamic text in variables for maintainability
- Line Breaks: Use
\nwithin text to create line breaks without starting a new paragraph
Best Practices
- Test Fonts: Verify that selected fonts are available on target systems
- Professional Spacing: Use 6pt or 12pt spacing after paragraphs instead of multiple blank lines
- Unicode Support: The node supports Unicode characters for international text
- Document Structure: Add text in logical order to build well-structured documents
- Reusability: Store common text snippets in variables for reuse across multiple documents
Common Errors and Solutions
| Error | Cause | Solution |
|---|---|---|
| "File Descriptor cannot be empty" | No file descriptor provided | Ensure Create Word or Open Word node runs first and passes the file descriptor |
| "Document not found" | Invalid file descriptor | Check that the file descriptor matches the one from Create/Open Word node |
| "Text cannot be empty" | No text content provided | Provide text content in the Text input |
| "Font Size must be a positive number" | Font size is zero or negative | Use a positive number (e.g., 12) |
| "Space After must be a non-negative number" | Negative space value | Use zero or a positive number |
| "Font Name cannot be empty" | No font specified | Provide a font name like "Arial" or "Times New Roman" |
| "Failed to add text to document" | Runtime error | Check all parameters are valid and document is accessible |
Font Size Reference
| Size (pt) | Typical Use |
|---|---|
| 8-9 | Footnotes, captions |
| 10-11 | Small body text |
| 12 | Standard body text |
| 14 | Subheadings |
| 16 | Section headings |
| 18-20 | Main titles |
| 22+ | Large titles, covers |
Spacing Reference
| Space (pt) | Visual Effect |
|---|---|
| 0 | No spacing (consecutive lines) |
| 6 | Minimal spacing |
| 12 | Standard paragraph spacing |
| 18 | Large spacing for sections |
| 24+ | Major section breaks |