This repository is a production-grade, canvas-based WYSIWYG rich text document editor published as the npm package `@hufe921/canvas-editor`. It is a monolithic library that provides a fully self-contained document editing experience, rendering text, tables, images, LaTeX, and form controls entirely on an HTML `<canvas>` element. The architecture is a well-structured layered design featuring a Command pattern facade (`Command`/`CommandAdapt`), a custom particle-based rendering engine (`Draw`), a pub/sub event system (`EventBus`), and a plugin system. The editor supports a wide array of features including pagination, headers/footers, watermarks, change tracking (trace mode), macros, spell checking, accessibility, multi-column layouts, and a sophisticated cascade expression engine for dynamic form control behavior. It is specifically designed for high-fidelity document editing in domains like Electronic Medical Records (EMR), contracts, and official documents, as evidenced by the mock data and feature set. The codebase demonstrates strong engineering craftsmanship. Several components are genuinely reusable, including a custom Myers O(ND) diff algorithm, a standalone LaTeX-to-SVG renderer using Hershey fonts, a fully featured DSL expression evaluator for control cascading, and a clean event bus implementation. The project is actively maintained with a comprehensive test suite (Cypress E2E, Vitest unit tests), modern tooling (Vite, TypeScript), and a rich plugin ecosystem. While some core files like `Draw.ts` and `CommandAdapt.ts` are large and exhibit tight coupling, the overall architecture, separation of concerns, and quality of the reusable components are well above average.
OfficeCLI is a cross-platform CLI application written in C#/.NET that creates, reads, and mutates OOXML Office documents (Word .docx, Excel .xlsx, PowerPoint .pptx) without requiring Microsoft Office. It is explicitly engineered as an agent-facing tool: every document element is addressable through a uniform path syntax (e.g. /slide[1]/shape[2]), all commands emit structured JSON with error codes and suggestions, and it ships AI-skill files for Claude/Copilot/Cursor/Codex, an MCP server, plus Python and Node SDKs. The core operation model is a batch command language: documents are mutated by replayable JSON items (add/set/remove/get) executed atomically through the CLI or over a named pipe to a resident process. Architecturally the repo is a single .NET binary (embedded runtime) with a CommandBuilder layer, a DocumentHandlerFactory dispatching to three large partial-class handlers (WordHandler, ExcelHandler, PowerPointHandler), and a shared Core layer containing chart-to-SVG rendering, a formula evaluator implementing 350+ Excel functions with statistical distributions, pivot table construction, Mermaid diagram parsing, OOXML theme/table-style resolution, HTML/PNG/SVG preview rendering, and a plugin protocol for foreign-format dump-readers and exporters. Security is taken seriously: SsrfGuard validates remote fetch targets, HyperlinkUriValidator allowlists URI schemes, XmlTextValidator and DocumentLimits guard against decompression bombs and DOM sprawl, and AtomicPackageWriter prevents torn file writes. Quality is strong but carries real maintenance debt. The code demonstrates deep OOXML craftsmanship - schema-order-correct XML insertion, exact EMU unit round-trips, Lanczos-based gamma functions, and curated chart-style galleries. However, handlers are split across dozens of partial-class files that evolved from former god methods, the property API is stringly-typed (props dictionaries parsed per key), examples must be maintained in parallel shell and Python twins, and the tool deliberately tolerates 'UNSUPPORTED props' warnings (exit code 2), which can mask incomplete feature coverage. The best reuse targets are the self-contained Core utilities rather than the format handlers. The project is actively maintained with multi-platform CI publishing to npm and PyPI.
UniOffice is a commercial Go library for reading, writing, and converting Office Open XML (OOXML) documents, including Word (.docx), Excel (.xlsx), and PowerPoint (.pptx) formats. It provides a high-level API for document manipulation, supporting features such as text formatting, tables, images, charts, animations, ActiveX controls, digital ink, and 3D models. The library also includes conversion to PDF via the UniPDF dependency. Architecturally, the library is layered: low-level schema types auto-generated from OOXML schemas handle XML marshalling/unmarshalling and validation; a middle layer of wrapper structs (e.g., Document, Spreadsheet, Presentation) provides a user-friendly interface; and conversion utilities transform documents to PDF. Key entry points include the main module (unioffice.go) for namespace handling and document type detection, common/common.go for core types like DocBase and ContentTypes, and the document/spreadsheet/presentation modules for specific operations. Data flows involve reading a ZIP package, parsing XML into schema types, manipulating via the high-level API, and writing back. The library relies on external dependencies such as unipdf (PDF generation), unichart (chart rendering), unitype (font parsing), and others for encryption and image processing. It requires a license key and uses obfuscated generated code to protect intellectual property. Despite the obfuscation, the library contains several well-designed, reusable components such as a storage abstraction, logger interface, wildcard matching, natural sort, measurement conversions, color parsing, MS-CFB binary format reader/writer, and an Excel number format engine. These components are self-contained and could be extracted for use in other projects.