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

Quick Start

Create your first Word document with BoxLang in under 5 minutes

Get up and running with the BoxLang Word Module in minutes.


📦 Installation

Install the module via CommandBox:

box install bx-word

This module requires a BoxLang+ license. Make sure bx-plus is installed and licensed.


1. Your First Document

Create a new document, add content, and save it — all in a single fluent chain:

word( "my-first-document.docx" )
    .addHeading( "Hello, BoxLang!", 1 )
    .addParagraph( "This is my first Word document created with BoxLang." )
    .save()

That's it! You now have a .docx file on disk.


2. Adding Content

Headings

Add headings at levels 1 through 6:

Paragraphs

Plain and formatted paragraphs:

Tables

Tables from arrays, queries, or structs:

Lists

Ordered and unordered lists:

Images

Images from files, bytes, base64, or URLs:

Clickable links:


3. Opening Existing Documents

Load an existing .docx file to modify it:


4. Template Population

Replace {{placeholders}} in a template with real data:


5. Exporting to Other Formats

Convert your document to text, Markdown, or HTML:

Method
Output

.toText()

Plain text with tab-separated tables

.toMarkdown()

Markdown with YAML front matter, pipe tables, base64 images

.toHTML()

HTML with inline styles and base64 images


6. Page Setup

Control margins, size, orientation, headers, and footers:


7. Document Properties

  • Dive into the User Guide for comprehensive coverage

  • Explore Formatting options for paragraphs and runs

  • Learn about Import & Export conversion pipelines

  • Check out Advanced Features for watermarks, TOC, and protection

  • Browse Examples for real-world patterns

Last updated

Was this helpful?