lmoffice reference
Complete CLI subcommands, flags, Word/Excel/PowerPoint schema types and methods, standard lmcode_std_v3 catalog functions, and exit codes for lmoffice.
CLI subcommands and flags
| Command or flag | Arguments | Description |
|---|---|---|
| lmoffice --version | none | Print the lmoffice version string and exit 0. |
| lmoffice docx | --help | --lmcode-schema [--json] | --lmcode-signatures | --lmcode FILE | Word (.docx) host route: inspect embedded schema, print canonical signatures, or execute compiled bytecode. |
| lmoffice xlsx | --help | --lmcode-schema [--json] | --lmcode-signatures | --lmcode FILE | Excel (.xlsx) host route: inspect embedded schema, print canonical signatures, or execute compiled bytecode. |
| lmoffice pptx | --help | --lmcode-schema [--json] | --lmcode-signatures | --lmcode FILE | PowerPoint (.pptx) host route: inspect embedded schema, print canonical signatures, or execute compiled bytecode. |
| lmoffice inspect | FILE [--markdown] | Validate a .docx, .xlsx, or .pptx file with OpenXmlValidator and print a JSON summary (or extracted Markdown with --markdown). |
Word schema (lmoffice docx)
| Type / context | Method signature | Description |
|---|---|---|
| context docx: DocxHost | docx.create(string) -> Docx | Create a new Word document builder targeting the given output path. |
| DocxHost | docx.inspect(string) -> string | docx.to_markdown(string) -> string | Inspect an existing .docx package as JSON or extract its content as Markdown. |
| DocxHost | docx.sample_image(string) -> void | Write a self-contained 64x64 sample PNG image to the given path. |
| Docx | d.heading(string, int) -> Paragraph | d.paragraph(string) -> Paragraph | Append a heading at level 1..6 or a body paragraph and return its Paragraph handle. |
| Docx | d.bullet(string) -> Paragraph | d.numbered(string) -> Paragraph | Append a bulleted or numbered list item paragraph. |
| Docx | d.clause(string, int) -> Paragraph | d.signature(string) -> Paragraph | Append a numbered legal clause at level 1..3 or a signature block line. |
| Docx | d.table(int, int) -> Table | d.image(string, int, int) -> Docx | Append a rows-by-cols table or an inline image with width and height in pixels. |
| Docx | d.page_break() -> Docx | d.section_break(string) -> Docx | Insert a page break or a section break (such as nextPage, continuous, landscape). |
| Docx | d.header(string) -> Docx | d.footer(string) -> Docx | Set plain text running header or footer. |
| Docx | d.header_fields(string) -> Docx | d.footer_fields(string) -> Docx | Set running header or footer supporting {PAGE} and {NUMPAGES} fields. |
| Docx | d.title(string) -> Docx | d.author(string) -> Docx | Set package metadata title and author properties. |
| Docx | d.font(string) -> Docx | d.font_size(float) -> Docx | Set default document font family and size in points. |
| Docx | d.page_size(float, float) -> Docx | d.orientation(string) -> Docx | d.margins(float, float, float, float) -> Docx | Configure page width and height in points, orientation (portrait or landscape), and top/right/bottom/left margins. |
| Docx | d.columns(int, float) -> Docx | d.text_box(string, float, float) -> Docx | Configure multi-column section layout (count, space_pt) or insert a bordered text box. |
| Docx | d.toc(string, int) -> Docx | d.heading_numbering(bool) -> Docx | Insert a table of contents with title and max depth, or enable hierarchical heading numbering. |
| Docx | d.markdown(string) -> Docx | d.markdown_file(string) -> Docx | Append document content parsed from an inline Markdown string or a UTF-8 Markdown file. |
| Docx | d.html_doc(string, string) -> Docx | d.html_xml(string, string) -> Docx | Append content from html-doc@1 / css-doc@1 strings or legacy html-subset@1 / css-subset@1 strings. |
| Docx | d.save() -> void | Write and close the .docx package on disk. |
| Paragraph | p.bold(bool) | p.italic(bool) | p.size(float) | p.color(string) | p.align(string) | p.font(string) -> Paragraph | Style paragraph text runs and alignment (left, center, right, justify). |
| Paragraph | p.spacing(float, float, float) | p.indent(float, float, float) | p.keep_with_next(bool) | p.tab_stop(float, string) -> Paragraph | Set before/after/line spacing, left/right/first-line indent, pagination keep, or tab stop position and alignment. |
| Paragraph | p.hyperlink(string, string) | p.footnote(string) | p.comment(string, string) | p.inserted(string, string) | p.deleted(string, string) -> Paragraph | Append a hyperlink (text, url), footnote, author comment, or tracked insertion/deletion. |
| Table | t.cell(int, int, string) -> Table | t.paragraph(int, int, string) -> Paragraph | Set 1-based cell text or create a stylable Paragraph inside a cell. |
| Table | t.borders(bool) | t.column_width(int, float) | t.shade(int, int, string) | t.merge(int, int, int, int) | t.cell_border(int, int, string, string, int) -> Table | Configure table borders, column width in points, hex cell shading, rectangular cell merge, or individual cell border side/color/size. |
Excel schema (lmoffice xlsx)
| Type / context | Method signature | Description |
|---|---|---|
| context xlsx: XlsxHost | xlsx.create(string) -> Xlsx | xlsx.inspect(string) -> string | xlsx.to_markdown(string) -> string | xlsx.sample_image(string) -> void | Create a workbook, inspect or convert an existing .xlsx file to Markdown, or generate a 64x64 sample PNG. |
| Xlsx | wb.sheet(string) -> Sheet | wb.sheet_from_markdown_table(string, string) -> Sheet | wb.sheet_from_csv(string, string) -> Sheet | Create an empty worksheet or populate a typed worksheet from a Markdown table or CSV string. |
| Xlsx | wb.named_range(string, string, int, int, int, int) -> Xlsx | wb.image(string, int, int, int, int) -> Xlsx | wb.save() -> void | Define a workbook-level named range, embed an image on the active sheet, or save the .xlsx file. |
| Sheet | s.set(int, int, string|int|float|bool) -> Sheet | s.formula(int, int, string) -> Sheet | Set a 1-based (row, col) cell value or store an Excel formula expression. |
| Sheet | s.bold(int, int) | s.italic(int, int) | s.font_size(int, int, float) | s.font_color(int, int, string) | s.font_name(int, int, string) -> Sheet | Apply font styling to a cell at (row, col). |
| Sheet | s.fill(int, int, string) | s.number_format(int, int, string) | s.align(int, int, string) | s.valign(int, int, string) | s.wrap(int, int, bool) -> Sheet | Set cell background fill color, number format string, horizontal/vertical alignment, or text wrapping. |
| Sheet | s.border(int, int, string, string) | s.border_box(int, int, int, int, string, string) -> Sheet | Apply cell or range outline borders with style and hex color. |
| Sheet | s.col_width(int, float) | s.row_height(int, float) | s.col_hide(int, bool) | s.row_hide(int, bool) | s.col_group(int, int, bool) -> Sheet | Configure column widths, row heights, hidden rows/columns, or collapsible column outline groups. |
| Sheet | s.freeze(int, int) | s.merge(int, int, int, int) | s.tab_color(string) | s.page_orientation(string) | s.fit_to_page(int, int) | s.repeat_rows(int, int) -> Sheet | Freeze top rows and left columns, merge cell ranges, or configure worksheet tab color and print setup. |
| Sheet | s.autofilter(int, int, int, int) | s.table(int, int, int, int, string) | s.data_validation_list(int, int, int, int, string) | s.named_range(string, int, int, int, int) -> Sheet | Add an autofilter, formatted table, comma-separated dropdown validation list, or sheet named range. |
| Sheet | s.hyperlink(int, int, string, string) | s.comment(int, int, string, string) | s.image(string, int, int, int, int) -> Sheet | Attach a hyperlink, author comment, or anchored image to a cell. |
| Sheet | s.conditional_cell_is(int, int, int, int, string, string, string, string) | s.conditional_color_scale(int, int, int, int, string, string) | s.conditional_color_scale3(int, int, int, int, string, string, string) | s.conditional_icon_set(int, int, int, int, string) -> Sheet | Add conditional formatting rules (operator/formula/fill/font, 2-color or 3-color scales, or icon sets). |
| Sheet | s.bar_chart(int, int, int, int, string, string, string) | s.line_chart(int, int, int, int, string, string, string) | s.pie_chart(int, int, int, int, string, string, string) -> Sheet | Embed a native DrawingML bar, line, or pie chart anchored at (row1, col1, row2, col2) with title, category range, and value range. |
PowerPoint schema (lmoffice pptx)
| Type / context | Method signature | Description |
|---|---|---|
| context pptx: PptxHost | pptx.create(string) -> Pptx | pptx.inspect(string) -> string | pptx.to_markdown(string) -> string | pptx.sample_image(string) -> void | Create a presentation, inspect or convert an existing .pptx file to Markdown, or generate a 64x64 sample PNG. |
| Pptx | p.slide() -> Slide | p.theme(string, string, string, string) -> Pptx | p.markdown(string) -> Pptx | p.save() -> void | Add a slide, configure theme palette (primary, accent, background, text hex colors), build slides from Markdown, or save the .pptx package. |
| Slide | s.title(string) | s.title_slide(string, string) | s.section_header(string, string, string) | s.two_content(string, string, string) -> Slide | Set slide title or populate standard title, section-header, or two-column layouts. |
| Slide | s.text(float, float, float, float, string) | s.bullet(float, float, float, float, string) | s.hyperlink(float, float, float, float, string, string) -> Slide | Place a positioned text box, bullet list box, or hyperlink box at (x, y, w, h) in pixels. |
| Slide | s.image(string, float, float, float, float) | s.rect(float, float, float, float, string) | s.rounded_rect(float, float, float, float, string, string) | s.ellipse(float, float, float, float, string, string) -> Slide | Place an image, filled rectangle, or labeled rounded rectangle / ellipse at (x, y, w, h). |
| Slide | s.line(float, float, float, float, string, float) | s.arrow(float, float, float, float, string, float) -> Slide | Draw a line or arrow from (x1, y1) to (x2, y2) with hex color and stroke width. |
| Slide | s.notes(string) | s.footer(string) | s.slide_number(bool) | s.transition(string) -> Slide | Set speaker notes, slide footer text, slide number visibility, or slide transition effect. |
| Slide | s.table(float, float, float, float, int, int) -> PptxTable | Create a table at (x, y, w, h) with the specified row and column counts. |
| Slide | s.bar_chart(float, float, float, float, string, string, string, string) | s.line_chart(float, float, float, float, string, string, string, string) | s.pie_chart(float, float, float, float, string, string, string) -> Slide | Place a native bar, line, or pie chart at (x, y, w, h) with title, categories, values, and series name. |
| PptxTable | t.cell(int, int, string) | t.cell_bg(int, int, string) | t.cell_color(int, int, string) | t.bold(int, int, bool) | t.font_size(int, int, float) | t.align(int, int, string) | t.header_row(string, string) -> PptxTable | Populate and style 1-based PowerPoint table cells and header rows. |
Standard lmcode_std_v3 catalog
| Category | Functions, types, or signatures | Description |
|---|---|---|
| Strings and encodings | str_len, str_substr, str_find, str_contains, str_starts_with, str_ends_with, str_lower, str_upper, str_trim, str_replace, str_repeat, str_split, str_match, str_to_int, str_is_int, str_to_float, str_is_float, str_base64_encode, str_base64_decode, str_hex_encode, str_hex_decode | UTF-8 byte string inspection, manipulation, numeric parsing, and base64/hex encoding. |
| Math and files | math_abs, math_min, math_max, math_floor, math_ceil, math_round, math_sqrt, math_pow, file_read, file_write, file_append, file_exists, file_lines | Overloaded int/float math helpers and UTF-8 file I/O. |
| Collections, JSON, and return framing | IntList, FloatList, StrList, IntMap, FloatMap, StrMap, IntStack, FloatStack, StrStack, IntQueue, FloatQueue, StrQueue, IntPQ, FloatPQ, StrPQ, Json (json_parse, template_render), lmcode_return_set, lmcode_return_put, lmcode_return_put_null, lmcode_return_null | Typed containers, JSON parsing, Mustache-style template rendering, and structured LMCODE_RETURN payload builders. |
Exit codes
| Exit code | Phase | Meaning |
|---|---|---|
| 0 | success | Command, inspection, or _lmcode_ document generation succeeded. |
| 2 | cli | Invalid command-line flags, unknown subcommand, or malformed invocation manifest. |
| 3 | load / run | Bytecode loading failure, schema mismatch, or unhandled VM/runtime error. |
| 4 | app | Document validation failure, invalid table/cell coordinate, missing input file, or Open XML package write error. |