Formatting
Formatting and styling Word documents with BoxLang — fonts, alignment, spacing, page setup
Paragraph Formatting
Alignment
word()
.addParagraph( "Left-aligned (default)", { alignment: "LEFT" } )
.addParagraph( "Centered text", { alignment: "CENTER" } )
.addParagraph( "Right-aligned text", { alignment: "RIGHT" } )
.addParagraph( "Justified text fills the line width evenly on both sides.", { alignment: "JUSTIFY" } )
.save( "alignment.docx" )Spacing
word()
.addParagraph( "Paragraph with extra space below.", {
spacingAfter: 240 // 240 twips ≈ 12pt
} )
.addParagraph( "Double-spaced paragraph.", {
lineSpacing: 480 // 480 twips = double spacing
} )
.addParagraph( "1.5 line spacing with indent.", {
lineSpacing: 360, // 360 twips = 1.5 spacing
spacingBefore: 120,
firstLineIndent: 720 // 0.5 inch indent
} )Option
Unit
Description
Run Formatting
Font Properties
Colors
Combined Formatting
Page Setup
Margins
Page Size
Orientation
Headers & Footers
Tables
Headings
Hyperlinks
Lists
Unordered (Bulleted)
Ordered (Numbered)
With Nested Sub-lists
Default Font
Document Properties
📚 Related Resources
User GuideAdvanced FeaturesExamplesLast updated
Was this helpful?
