-
Notifications
You must be signed in to change notification settings - Fork 115
examples
Real-world examples from the OfficeCLI examples directory. Each demonstrates a complete scenario with production-quality output.
Source: examples/
Create a Word document with complex LaTeX formulas for algebra, calculus, physics, and chemistry.
Source: examples/gen-formulas.sh
officecli create formulas.docx
officecli open formulas.docx
# Title
officecli add formulas.docx /body --type paragraph --prop text="Formula Collection" --prop style=Heading1 --prop alignment=center
# Section heading
officecli add formulas.docx /body --type paragraph --prop text="I. Algebra" --prop style=Heading2
# Quadratic Formula
officecli add formulas.docx /body --type paragraph --prop text="Quadratic Formula:"
officecli add formulas.docx /body --type equation --prop 'formula=x = \frac{-b \pm \sqrt{b^{2} - 4ac}}{2a}'
# Euler's Identity
officecli add formulas.docx /body --type paragraph --prop text="Euler's Identity:"
officecli add formulas.docx /body --type equation --prop 'formula=e^{i\pi} + 1 = 0'
# Gaussian Integral
officecli add formulas.docx /body --type paragraph --prop text="Gaussian Integral:" --prop style=Heading2
officecli add formulas.docx /body --type equation --prop 'formula=\int_{-\infty}^{+\infty} e^{-x^{2}} dx = \sqrt{\pi}'
# Normal Distribution
officecli add formulas.docx /body --type paragraph --prop text="Normal Distribution PDF:"
officecli add formulas.docx /body --type equation --prop 'formula=f(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x-\mu)^{2}}{2\sigma^{2}}}'
# Chemistry: Dissolution
officecli add formulas.docx /body --type paragraph --prop text="Chemical Reaction:"
officecli add formulas.docx /body --type equation --prop 'formula=CuSO_{4} \cdot 5H_{2}O \rightarrow Cu^{2+} + SO_{4}^{2-} + 5H_{2}O'
officecli close formulas.docxSee: word-equation-add
Create a Word document with a project tracker table featuring vertical cell merges and color-coded progress.
Source: examples/gen-complex-tables.sh
officecli create tables.docx
officecli open tables.docx
officecli add tables.docx /body --type paragraph --prop text="Project Progress Tracker" --prop style=Heading1
# Create 7-row, 6-column table
officecli add tables.docx /body --type table --prop rows=7 --prop cols=6
# Header row (blue background, white text)
officecli set tables.docx '/body/tbl[1]/tr[1]/tc[1]' --prop text="Project" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF --prop valign=center
officecli set tables.docx '/body/tbl[1]/tr[1]/tc[2]' --prop text="Phase" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF
officecli set tables.docx '/body/tbl[1]/tr[1]/tc[3]' --prop text="Owner" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF
officecli set tables.docx '/body/tbl[1]/tr[1]/tc[4]' --prop text="Start" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF
officecli set tables.docx '/body/tbl[1]/tr[1]/tc[5]' --prop text="End" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF
officecli set tables.docx '/body/tbl[1]/tr[1]/tc[6]' --prop text="Progress" --prop bold=true --prop shd=4472C4 --prop color=FFFFFF
# Project A - vertically merged across 3 rows
officecli set tables.docx '/body/tbl[1]/tr[2]/tc[1]' --prop text="Smart Office" --prop vmerge=restart --prop valign=center --prop shd=D9E2F3
officecli set tables.docx '/body/tbl[1]/tr[2]/tc[2]' --prop text="Requirements"
officecli set tables.docx '/body/tbl[1]/tr[2]/tc[3]' --prop text="John"
officecli set tables.docx '/body/tbl[1]/tr[2]/tc[6]' --prop text="100%" --prop color=00B050
officecli set tables.docx '/body/tbl[1]/tr[3]/tc[1]' --prop text="" --prop vmerge=continue --prop shd=D9E2F3
officecli set tables.docx '/body/tbl[1]/tr[3]/tc[2]' --prop text="Development"
officecli set tables.docx '/body/tbl[1]/tr[3]/tc[3]' --prop text="Sarah"
officecli set tables.docx '/body/tbl[1]/tr[3]/tc[6]' --prop text="75%" --prop color=FFC000
officecli set tables.docx '/body/tbl[1]/tr[4]/tc[1]' --prop text="" --prop vmerge=continue --prop shd=D9E2F3
officecli set tables.docx '/body/tbl[1]/tr[4]/tc[2]' --prop text="Testing"
officecli set tables.docx '/body/tbl[1]/tr[4]/tc[3]' --prop text="Mike"
officecli set tables.docx '/body/tbl[1]/tr[4]/tc[6]' --prop text="0%" --prop color=FF0000
officecli close tables.docxSee: word-table-add, word-table-set
Create an Excel spreadsheet with sales data and multiple chart types.
Source: examples/gen-charts-demo.sh, examples/gen-beautiful-charts.sh
officecli create charts.xlsx
officecli open charts.xlsx
# Headers with colored backgrounds
officecli set charts.xlsx '/Sheet1/A1' --prop value="Month" --prop font.bold=true --prop fill=2F5496 --prop font.color=FFFFFF --prop alignment.horizontal=center
officecli set charts.xlsx '/Sheet1/B1' --prop value="East" --prop font.bold=true --prop fill=4472C4 --prop font.color=FFFFFF --prop alignment.horizontal=center
officecli set charts.xlsx '/Sheet1/C1' --prop value="South" --prop font.bold=true --prop fill=5B9BD5 --prop font.color=FFFFFF --prop alignment.horizontal=center
officecli set charts.xlsx '/Sheet1/D1' --prop value="North" --prop font.bold=true --prop fill=70AD47 --prop font.color=FFFFFF --prop alignment.horizontal=center
# Sample data
officecli set charts.xlsx '/Sheet1/A2' --prop value="Jan" --prop alignment.horizontal=center
officecli set charts.xlsx '/Sheet1/B2' --prop value=120 --prop numFmt="#,##0"
officecli set charts.xlsx '/Sheet1/C2' --prop value=95 --prop numFmt="#,##0"
officecli set charts.xlsx '/Sheet1/D2' --prop value=88 --prop numFmt="#,##0"
# ... repeat for more months
# Add a bar chart
officecli add charts.xlsx /Sheet1 --type chart \
--prop chartType=bar \
--prop title="Monthly Sales by Region" \
--prop categories="Jan,Feb,Mar,Apr,May,Jun" \
--prop series1="East:120,135,148,162,155,178" \
--prop series2="South:95,108,115,128,142,155" \
--prop series3="North:88,92,105,118,125,138" \
--prop colors=4472C4,ED7D31,70AD47
# Add a pie chart on a second sheet
officecli add charts.xlsx / --type sheet --prop name=Summary
officecli add charts.xlsx /Summary --type chart \
--prop chartType=pie \
--prop title="Regional Distribution" \
--prop categories="East,South,North,West" \
--prop data="Total:1926,1587,1397,1150"
officecli close charts.xlsxSee: excel-chart-add, excel-cell-set
Create a PowerPoint with animated shapes demonstrating all entrance effects.
Source: examples/gen-animations-pptx.sh
officecli create animations.pptx
officecli open animations.pptx
# Title slide with radial gradient background
officecli add animations.pptx / --type slide --prop layout=title
officecli set animations.pptx /slide[1] --prop background=radial:0D1B2A-1B4F72-bl
officecli set animations.pptx '/slide[1]/placeholder[centertitle]' \
--prop text="Animation Showcase" --prop color=FFFFFF --prop size=48
officecli set animations.pptx '/slide[1]/placeholder[subtitle]' \
--prop text="Every animation effect in OfficeCLI" --prop color=85C1E9 --prop size=22
officecli set animations.pptx /slide[1] --prop transition=fade
# Entrance animations slide
officecli add animations.pptx / --type slide --prop title="Entrance Effects"
officecli set animations.pptx /slide[2] --prop background=1B2838
officecli set animations.pptx '/slide[2]/shape[1]' --prop color=FFFFFF --prop size=28
# Animated shapes with different effects
officecli add animations.pptx '/slide[2]' --type shape \
--prop text="appear" --prop font=Consolas --prop size=14 --prop color=FFFFFF \
--prop fill=2E86C1 --prop preset=roundRect \
--prop x=1cm --prop y=4cm --prop width=5cm --prop height=2cm
officecli set animations.pptx '/slide[2]/shape[2]' --prop animation=appear-entrance-500
officecli add animations.pptx '/slide[2]' --type shape \
--prop text="fade" --prop font=Consolas --prop size=14 --prop color=FFFFFF \
--prop fill=27AE60 --prop preset=roundRect \
--prop x=7cm --prop y=4cm --prop width=5cm --prop height=2cm
officecli set animations.pptx '/slide[2]/shape[3]' --prop animation=fade-entrance-800
officecli add animations.pptx '/slide[2]' --type shape \
--prop text="fly" --prop font=Consolas --prop size=14 --prop color=FFFFFF \
--prop fill=E74C3C --prop preset=roundRect \
--prop x=13cm --prop y=4cm --prop width=5cm --prop height=2cm
officecli set animations.pptx '/slide[2]/shape[4]' --prop animation=fly-entrance-600
officecli add animations.pptx '/slide[2]' --type shape \
--prop text="zoom" --prop font=Consolas --prop size=14 --prop color=FFFFFF \
--prop fill=8E44AD --prop preset=roundRect \
--prop x=19cm --prop y=4cm --prop width=5cm --prop height=2cm
officecli set animations.pptx '/slide[2]/shape[5]' --prop animation=zoom-entrance-700
officecli close animations.pptxSee: ppt-shape-add, ppt-shape-set, ppt-slide-set
Create a visually stunning presentation using raw XML for advanced effects like semi-transparent shapes and gradient lines.
Source: examples/gen-beautiful-pptx.sh
officecli create design.pptx
officecli open design.pptx
# Create blank slide
officecli add design.pptx /presentation --type slide
# Dark gradient background (3-stop)
officecli raw-set design.pptx /slide[1] --xpath "//p:cSld" --action prepend --xml '
<p:bg>
<p:bgPr>
<a:gradFill rotWithShape="0">
<a:gsLst>
<a:gs pos="0"><a:srgbClr val="0D1B2A"/></a:gs>
<a:gs pos="50000"><a:srgbClr val="1B2838"/></a:gs>
<a:gs pos="100000"><a:srgbClr val="0A1628"/></a:gs>
</a:gsLst>
<a:lin ang="5400000" scaled="1"/>
</a:gradFill>
<a:effectLst/>
</p:bgPr>
</p:bg>'
# Semi-transparent decorative circle (top right)
officecli raw-set design.pptx /slide[1] --xpath "//p:cSld/p:spTree" --action append --xml '
<p:sp>
<p:nvSpPr><p:cNvPr id="100" name="Deco Circle"/><p:cNvSpPr/><p:nvPr/></p:nvSpPr>
<p:spPr>
<a:xfrm><a:off x="8500000" y="-1200000"/><a:ext cx="4800000" cy="4800000"/></a:xfrm>
<a:prstGeom prst="ellipse"><a:avLst/></a:prstGeom>
<a:solidFill><a:srgbClr val="00B4D8"><a:alpha val="8000"/></a:srgbClr></a:solidFill>
<a:ln><a:noFill/></a:ln>
</p:spPr>
<p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr/></a:p></p:txBody>
</p:sp>'
# Gradient accent line
officecli raw-set design.pptx /slide[1] --xpath "//p:cSld/p:spTree" --action append --xml '
<p:sp>
<p:nvSpPr><p:cNvPr id="102" name="Accent Line"/><p:cNvSpPr/><p:nvPr/></p:nvSpPr>
<p:spPr>
<a:xfrm><a:off x="800000" y="4200000"/><a:ext cx="5000000" cy="0"/></a:xfrm>
<a:prstGeom prst="line"><a:avLst/></a:prstGeom>
<a:ln w="28575">
<a:gradFill>
<a:gsLst>
<a:gs pos="0"><a:srgbClr val="00B4D8"/></a:gs>
<a:gs pos="100000"><a:srgbClr val="E0AAFF"/></a:gs>
</a:gsLst>
<a:lin ang="0" scaled="1"/>
</a:gradFill>
</a:ln>
</p:spPr>
<p:txBody><a:bodyPr/><a:lstStyle/><a:p><a:endParaRPr/></a:p></p:txBody>
</p:sp>'
# Title text
officecli add design.pptx /slide[1] --type shape \
--prop text="The Art of Design" --prop font=Arial --prop size=44 --prop bold=true --prop color=FFFFFF \
--prop x=800000 --prop y=2400000 --prop width=7000000 --prop height=1500000 --prop fill=none
officecli close design.pptxSee: command-raw-ppt, ppt-slide-set
Advanced Word textboxes with borders, backgrounds, and VML fallback using raw-set.
Source: examples/gen-complex-textbox.sh
officecli create textbox.docx
# Add a textbox with blue border and light blue background via raw XML
officecli raw-set textbox.docx /document --xpath "//w:body" --action append --xml '
<w:p>
<w:r>
<w:rPr><w:noProof/></w:rPr>
<mc:AlternateContent>
<mc:Choice Requires="wps">
<w:drawing>
<wp:anchor distT="0" distB="0" distL="114300" distR="114300"
simplePos="0" relativeHeight="251659264" behindDoc="0"
locked="0" layoutInCell="1" allowOverlap="1">
<wp:simplePos x="0" y="0"/>
<wp:positionH relativeFrom="column"><wp:posOffset>0</wp:posOffset></wp:positionH>
<wp:positionV relativeFrom="paragraph"><wp:posOffset>0</wp:posOffset></wp:positionV>
<wp:extent cx="5400000" cy="1200000"/>
<wp:wrapTopAndBottom/>
<wp:docPr id="1" name="TextBox 1"/>
<a:graphic>
<a:graphicData uri="http://schemas.microsoft.com/office/word/2010/wordprocessingShape">
<wps:wsp>
<wps:cNvSpPr txBox="1"/>
<wps:spPr>
<a:xfrm><a:off x="0" y="0"/><a:ext cx="5400000" cy="1200000"/></a:xfrm>
<a:prstGeom prst="rect"><a:avLst/></a:prstGeom>
<a:solidFill><a:srgbClr val="E6F3FF"/></a:solidFill>
<a:ln w="25400"><a:solidFill><a:srgbClr val="0070C0"/></a:solidFill></a:ln>
</wps:spPr>
<wps:txbx>
<w:txbxContent>
<w:p><w:pPr><w:jc w:val="center"/></w:pPr>
<w:r><w:rPr><w:b/><w:sz w:val="28"/><w:color w:val="0070C0"/></w:rPr>
<w:t>Textbox Title</w:t></w:r></w:p>
<w:p><w:r><w:t>Content paragraph inside textbox.</w:t></w:r></w:p>
</w:txbxContent>
</wps:txbx>
<wps:bodyPr rot="0" vert="horz" wrap="square"
lIns="91440" tIns="45720" rIns="91440" bIns="45720" anchor="t"/>
</wps:wsp>
</a:graphicData>
</a:graphic>
</wp:anchor>
</w:drawing>
</mc:Choice>
</mc:AlternateContent>
</w:r>
</w:p>'See: command-raw-word
| Script | Format | Description |
|---|---|---|
gen-formulas.sh |
Word | 30+ math/chemistry/physics formulas (LaTeX) |
gen-complex-tables.sh |
Word + Excel + PPT | Merged cells, multi-level headers, color-coded data |
gen-complex-textbox.sh |
Word | 10 textbox scenarios via raw XML |
gen-charts-demo.sh |
Excel | 6 chart types with 12-month sales data |
gen-beautiful-charts.sh |
Excel | 8 advanced chart types across 4 sheets |
gen-animations-pptx.sh |
PowerPoint | All entrance/exit/emphasis animation effects |
gen-beautiful-pptx.sh |
PowerPoint | Decorative design with gradients and transparency |
gen-video-pptx.py |
PowerPoint | Video/audio embedding (Python) |
Based on OfficeCLI v1.0.33