Standalone Go library for bounded OOXML/PPTX package handling and PowerPoint template operations
Extracted from OpenAgent's PowerPoint tool layer
office-tool-use is the native Go implementation behind OpenAgent's PowerPoint template tools, pulled out into its own dependency-light package. It opens a .pptx as a bounded OPC/ZIP package, analyzes its slides into a JSON-friendly model, lets a caller scaffold and validate a fill plan, and applies that plan back into a new .pptx — covering text, tables, images, charts, notes, transitions, and SmartArt.
It has no dependency on the OpenAgent server, MCP layer, or any LLM/agent code — it's a pure library that any Go application can import directly.
*.go(root packageoffice): the analyze → scaffold → check → fill pipeline that orchestrates template operations.template_analyze.go: parse a.pptxinto amodel.Librarydescribing its slides and placeholders.template_scaffold.go: build an emptymodel.Planfrom a library for selected slides.template_check.go: validate a filled plan against the library before applying it.template_apply.go: apply a plan to produce the output.pptx.template_chart.go,template_image.go,template_text.go,template_notes.go,template_transition.go,template_layout.go,template_clone.go: per-feature handling used by the analyze/apply pipeline.
ooxml/: lower-level OPC ZIP package access — bounded allocator, content types, relationships, XML tree helpers, atomic file writes (Unix/Windows variants).model/: the JSON DTOs (Library,Plan,CheckReport,ApplyOptions, etc.) shared between the analyze, check, and apply stages.smartart/: SmartArt-specific graphics handling, isolated from the rest of the template pipeline.
go get github.com/the-open-agent/office-tool-useimport (
office "github.com/the-open-agent/office-tool-use"
"github.com/the-open-agent/office-tool-use/model"
"github.com/the-open-agent/office-tool-use/ooxml"
)
// 1. Analyze an existing .pptx into a library of slides/placeholders.
library, err := office.AnalyzeFile("input.pptx", ooxml.DefaultLimits())
// 2. Scaffold an empty fill plan for the slides you want to populate.
plan := office.ScaffoldPlan(library, []int{0, 1, 2}, false)
// ... populate plan.Slides[i] with text/table/image/chart content ...
// 3. Validate the filled plan against the library.
report := office.CheckPlan(library, plan)
// 4. Apply the plan to produce the output .pptx.
report, err = office.FillFile("input.pptx", "output.pptx", plan, model.ApplyOptions{}, ooxml.DefaultLimits())go test ./...