For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

API Type
Entry Point
Use Case

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 FactoriesWordDocument.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

Guide
Description

Quick Start

Create your first Word document in 5 minutes

User Guide

Comprehensive usage guide for all features

Formatting

Fonts, alignment, spacing, and page setup

Import & Export

Convert between text, Markdown, HTML, and Word

Advanced Features

Watermarks, TOC, protection, section breaks

Examples

Real-world scenarios and patterns

BIF Reference

The word() BIF

Fluent API Reference

Complete WordDocument API


💬 Support & Community


Built with ❤️ by Ortus Solutions

Professional Services Available — Need help with BoxLang implementation, training, or consulting? Contact Ortus Solutions

Last updated

Was this helpful?