User Guide
Complete guide to creating, modifying, and exporting Word documents with BoxLang
Core Concepts
The word() BIF
word() BIFresult = word() // new empty document
result = word( "/path/to/file.docx" ) // open existing file
result = word( text="Hello World" ) // create from text
result = word( markdown="## Title" ) // create from Markdown
result = word( html="<h1>Title</h1>" ) // create from HTMLThe WordDocument Object
WordDocument Objectword()
.margins( 1.5, 1.5, 1.5, 1.5 )
.addHeading( "Title", 1 )
.addParagraph( "Content" )
.save( "output.docx" )Method Chaining Pattern
Creating Documents
From Scratch
Opening Existing Files
From Text Content
From Markdown
From HTML
Paragraphs
Option
Type
Description
Page Breaks
Empty Lines
Tables
From a 2-D Array
From a Query
From a Struct
Lists
Unordered (Bulleted)
Ordered (Numbered)
Nested Lists
Images
From File Path
From Bytes
From Base64
From URL
Hyperlinks
Page Setup
Margins
Page Size
Orientation
Headers & Footers
Section Breaks
Template Population
Placeholder Replacement
Literal Find & Replace
Bookmarks
Saving & Exporting
Save to File
Get as Bytes
Get as Base64
Write to Stream
Document Properties
Fluent Helpers
tap() — Side Effects in Chains
tap() — Side Effects in Chainswhen() — Conditional Branching
when() — Conditional BranchingDocument Cleanup
📚 Related Resources
FormattingImport & ExportAdvanced FeaturesExamplesFluent APILast updated
Was this helpful?
