Examples
Real-world examples of Word document generation with BoxLang
1. Sales Report
salesData = queryExecute( "
SELECT product_name, units_sold, unit_price,
(units_sold * unit_price) as revenue
FROM sales
WHERE quarter = 'Q4'
ORDER BY revenue DESC
" )
word( "sales-report.docx" )
.margins( 1.5, 1.5, 1.5, 1.5 )
.setTitle( "Q4 Sales Report" )
.setAuthor( "Sales Department" )
.setSubject( "Quarterly sales summary" )
.header( "ACME Corp — Q4 2024 Sales Report" )
.addHeading( "Q4 2024 Sales Report", 1 )
.addParagraph( "Generated on " & dateTimeFormat( now(), "yyyy-mm-dd HH:nn" ), {
italic: true,
size: 10,
color: "808080"
} )
.addParagraph( "The following report summarizes sales performance for Q4 2024.", {
spacingAfter: 240
} )
.addTable( salesData )
.addPageBreak()
.addHeading( "Summary", 2 )
.addParagraph( "All products met or exceeded quarterly targets.", { bold: true } )
.save()2. Contract Generation from Template
3. Invoice Builder
4. Meeting Minutes with Nested Lists
5. Employee Handbook with TOC
6. Marketing Brochure with Images
7. Batch Document Generation
8. Format Conversion Pipeline
📚 Related Resources
User GuideAdvanced FeaturesImport & ExportFluent APILast updated
Was this helpful?
