Word +
A powerful BoxLang module for creating, reading, populating, and converting Word documents with a fluent, chainable API
The BoxLang Word Module (bx-word) is a fluent document builder for .docx files in BoxLang. Built on Apache POI, it lets you create, populate, style, and export Word documents with a clean, chainable API. Import content from text, Markdown, and HTML on the fly.
Fluent API ✨
word()
Modern chainable interface (recommended)
Importers 📥
.fromText() / .fromMarkdown() / .fromHTML()
Ingest content from multiple formats
Exporters 📤
.toText() / .toMarkdown() / .toHTML()
Convert documents to text or markup
💡 The fluent API is the recommended approach. Chain methods to build, style, and save documents in a single expression.
✨ Key Features
✨ Fluent Method Chaining — Intuitive, readable code
📝 Template Population —
{{placeholder}}substitution with struct data📊 Table Support — Arrays, Queries, and Struct-based tables with auto-header bolding
🎨 Rich Formatting — Bold, italic, colors, fonts, alignment, spacing
📥 Multi-Format Import — Plain text, Markdown (CommonMark), HTML (Jsoup)
📤 Multi-Format Export — Plain text, Markdown, HTML (inline styles + base64 images)
🖼️ Image Embedding — From file path, byte array, base64 string, or URL
📄 Page Setup — Margins, page size, orientation, headers, footers, section breaks
🔗 Hyperlinks — Clickable links with underline styling
📋 Lists — Ordered and unordered lists with nested/indented support
📖 Document Properties — Title, author, subject, keywords
🔒 Document Protection — Password-protect documents
🏷️ Watermarks — "DRAFT", "CONFIDENTIAL", or custom text
📑 Table of Contents — Insert TOC field for Word to generate
🔀 Static Factories —
WordDocument.fromText(),.fromMarkdown(),.fromHTML()⚡ Fluent Helpers —
.tap()for side effects,.when()for conditional chaining
📋 Requirements
BoxLang Runtime 1.14.0 or higher
BoxLang+ License — This module requires a BoxLang+ license
📦 Installation
Using CommandBox:
🚀 Quick Start
Create Your First Document
Populate a Template
Create from Text, Markdown, or HTML
Export to Text, Markdown, or HTML
📖 Documentation
Create your first Word document in 5 minutes
Comprehensive usage guide for all features
Fonts, alignment, spacing, and page setup
Convert between text, Markdown, HTML, and Word
Watermarks, TOC, protection, section breaks
Real-world scenarios and patterns
The word() BIF
Complete WordDocument API
💬 Support & Community
📧 Email: support@ortussolutions.com
💬 Slack: Join BoxLang Community
🐛 Issues: GitHub Issues
📖 Forums: BoxLang Forums
📚 Docs: BoxLang Documentation
Built with ❤️ by Ortus Solutions
Professional Services Available — Need help with BoxLang implementation, training, or consulting? Contact Ortus Solutions
Last updated
Was this helpful?
