Skip to content

feat(office): add charts, equations and font inheritance controls - #3768

Merged
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/office-word-excel-completion
Nov 6, 2026
Merged

bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/office-word-excel-completion

Conversation

@bobleer

@bobleer bobleer commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

GenOfficeFile can now create editable Excel charts and Word equations directly, preserve content during incremental edits, and style mixed-language text without forcing one font across every script. Word, Excel and PowerPoint now share explicit font defaults, recovery instructions and verification status across the tool prompt, schema and guides.

Type and Areas

Type: Feature, bug fix, tool guidance, regression tests.

Areas: Portable Office document engine; Core GenOfficeFile tool; DOCX/XLSX/PPTX guides.

Motivation / Impact

  • Add native XLSX column, bar, line and pie charts through add_chart, replace_chart and delete_chart, with schema/guide examples and readable model output. Charts reference worksheet ranges and carry caches for immediate display. Sheet renames and row/column edits update their references; deleted sources produce explicit warnings.
  • Preserve literals and formulas on style-only cell updates. Reject invalid cell formula/type values rather than silently ignoring them.
  • Let DOCX text replacement match across formatted runs while preserving unmatched formatting and content boundaries. Include code/captions/TOC titles, with opt-in header/footer replacement, and handle Unicode lowercase expansions correctly.
  • Convert Markdown or explicit LaTeX math runs into native Word equations in memory. Cover fractions, roots, scripts, sums, integrals, accents and matrices with scalable delimiters. Preserve formula source for reads and incremental edits; unsupported expressions fail atomically with corrective guidance. Plain text replacement does not modify formulas.
  • Apply Word language defaults/overrides consistently and preserve East Asian font fallback in code runs. Share script inference with PowerPoint without adding machine-specific font substitutions.
  • Preserve existing all-script font behavior while adding local latin_font, east_asia_font and complex_script_font overrides for Word/PPT, plus complex-script document/theme defaults. An intended Latin-only change can now leave East Asian inheritance intact. PPT paragraph/run/element precedence is explicit.
  • Restore Word/PPT font inheritance through null patches; add XLSX format_range.reset_font to remove only the font name while preserving values, formulas and all other formatting. Stop classifying every custom Excel font as sans-serif.
  • Guide agents to omit font choices unless the user/template requires them. Describe family-name semantics and each format's field scope; reject empty, non-string or control-character names before IO. Preserve names in legacy files and avoid platform font aliases, blacklists or host inventory assumptions.
  • Return fonts_verified:false on writes and reads, with an explicit target-viewer caveat. Structural warnings and valid Unicode do not prove correct glyph rendering.
  • Unify the tool description, all format guides and successful-write feedback around structural verification. Explain that visual inspection is a separate task; do not automatically probe, install or repair LibreOffice/soffice or construct a substitute renderer. Formula-cache warnings no longer suggest an installation dependency.

Verification

  • cargo test --locked -p openbitfun-office-documents — 30 unit tests and 22 integration tests passed.
  • cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,git,tools-office-documents --lib agentic::tools::implementations::gen_office_file_tool::tests — 6 tests passed.
  • pnpm run fmt:rs, pnpm run check:core-boundaries, pnpm run check:repo-hygiene, and git diff --check — passed.
  • Tool-level create/edit/read/failure recovery exercised for all three formats using local and simulated SSH workspace IO, including chart references, math source preservation, script-specific font fields and Excel font reset. Invalid operations leave saved bytes unchanged. Hand-authored legacy Word/Excel/PPT payloads retain defaults and unknown fields on round trip; legacy font fields remain readable and keep their scope.
  • Font regression samples opened in native Word, Excel and PowerPoint on macOS: English, Simplified/Traditional Chinese, Japanese, Korean and Arabic text displayed correctly after default restoration or Latin-only overrides; Excel formulas and other styles remained intact. Explicit font precedence, null recovery and invalid-input atomicity are also checked in exported OOXML.
  • Additional generated samples opened in Microsoft Office on macOS: Excel displayed all four native chart types with axes, labels and multilingual cells; Word displayed edited multilingual text, tables, headers/footers and a two-page paper with native equations; PowerPoint displayed multilingual text and notes. Matrix delimiter sizing and Excel axis visibility were corrected from those observations. This is evidence for the tested applications/environment, not universal viewer compatibility.

Reviewer Notes

  • Follow-up to merged fix(office): improve tool contracts and multilingual document output #3766. Refreshed upstream main and checked open PRs, including drafts; these additions are not covered by the earlier fix.
  • The engine remains platform-independent and IO-free. math-core (MIT, default features disabled) parses LaTeX; existing roxmltree moves from test-only to runtime use for the MathML bridge. No Office/TeX executable, platform API or host process is introduced.
  • Stored fields are additive/defaulted. Legacy font names are not revalidated on load; existing font scopes and Excel null-as-no-op behavior remain compatible. Older engines preserve unknown model fields but cannot render new chart/equation capabilities. Existing file envelopes, workspace routing and wire protocols are unchanged.
  • Live SSH, remote control, Peer Device Mode and Detached Dispatch were not exercised. No live model/provider evaluation was performed; guidance regression checks do not prove a model will never attempt an unnecessary external command.
  • Word calculates TOC page numbers after pagination; a field refresh may be required. Citation markers/bibliography text are supported, but automatic citation databases, cross-reference numbering and footnotes are outside this change. Unsupported TeX structures return explicit errors.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer bobleer changed the title feat(office): add Excel charts and Word equations feat(office): add charts, equations and font inheritance controls Nov 6, 2026
@bobleer
bobleer merged commit f7f5b41 into GCWing:main Nov 6, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant