lmoffice guide

Architecture, document-as-code workflows, Open XML layout rules, and the standard lmcode_std_v3 library for lmoffice.

Overview

lmoffice packages Microsoft's Open XML SDK (DocumentFormat.OpenXml 3.5.1) and the lmcode runtime into a single .NET 8 NativeAOT executable with three format-specific subcommands: docx, xlsx, and pptx. Each subcommand embeds its own schema and exposes a root factory context alongside the built-in lmcode_std_v3 standard library, while the shared inspect subcommand validates generated packages with OpenXmlValidator and extracts JSON summaries or canonical Markdown.

Subcommand architecture and format contexts

Because Word, Excel, and PowerPoint have distinct object models, lmoffice separates them into dedicated CLI routes so each _lmcode_ block compiles against a focused schema:

Documents as code: Markdown and XHTML/CSS profiles

In addition to fine-grained builder calls, lmoffice supports declarative document-as-code authoring across all three formats:

content = "<article xmlns=\"http://www.w3.org/1999/xhtml\"><h1>Quarterly update</h1><p>Capacity is <strong>stable</strong>.</p></article>";
styles = "<style xmlns=\"urn:lmctl:css:1\"><rule select=\"p\"><set name=\"margin-bottom\" value=\"6pt\"/></rule></style>";
p = _lmcode_ cli="lmoffice docx" install="github:lmctl-ai/lmoffice@v0.1.33";
let d = docx.create("update.docx");
d.html_doc(${content}, ${styles});
d.save();
end _lmcode_
r = run_lmcode(p);
require(r.ok, json_stringify(r));

Coordinate conventions and layout rules

Standard lmcode_std_v3 library

All three format registries include the standard lmcode_std_v3 catalog of string, math, collection (IntList, FloatList, StrList, IntMap, FloatMap, StrMap, stacks, queues, priority queues), JSON, template, file, and return-framing functions. The REST and CLI handler interfaces of newer lmcode_std_v3 catalogs are not documented for this host; check lmoffice docx --lmcode-signatures on the installed release before relying on them.