Command Line and Conversion

Every Methodox Office application understands LibreOffice's command line, so a script written for soffice --headless --convert-to pdf runs unchanged against Methodox Office, and mos is the one command for the whole suite.

mos

mos.exe sits beside the applications, and the installer can put it on PATH. It is to Methodox Office what soffice is to LibreOffice: it takes LibreOffice's switches and the suite's own, sends each document to its application by extension, and carries out conversions, scripts and other headless work in its own process, so a prompt or a script waits for it and sees its exit code. The applications themselves are windowed programs, which a prompt does not wait for.

mos                                    open the Start Centre
mos Report.docx Budget.xlsx            open each document in its application
mos --calc                             open Formula with a new workbook
mos --convert-to pdf --outdir out *.docx *.xlsx
mos --cat Letter.docx                  the text of a document on standard output
mos --script Tidy.lua --save-as Tidied.docx Report.docx
mos --calc --help                      Formula's own switches

--writer, --calc, --impress, --draw and --math choose the application instead of the extension (mos --draw Plan.pptx opens a deck in Nu). Documents to look at open in their application's window, which mos does not wait for. mos exits with 0 when everything succeeded, 1 when a file could not be converted or an application could not start, and 2 for a mistake on the command line.

Converting documents

MethodoxImpulse --convert-to pdf --outdir out *.docx
MethodoxFormula --convert-to csv --outdir out Budget.xlsx
MethodoxExpo --convert-to pdf:impress_pdf_Export:{"PageRange":{"type":"string","value":"2-3"}} Deck.pptx
MethodoxOffice --convert-to pdf --outdir out a.docx b.xlsx c.pptx

--convert-to <extension>[:<filter>[:<options>]] converts each file without opening a window and writes it into --outdir (the current folder when left out), printing what LibreOffice prints (convert Report.docx as a Writer document -> out\Report.pdf using filter : writer_pdf_Export), so scripts that read that output keep working. Wildcards are expanded. What a conversion could not carry is printed on standard error as Warning: lines. The exit code is 0, or 1 when any file failed.

Application --convert-to Filter names
Impulse pdf docx txt rtf odt html png jpg writer_pdf_Export, MS Word 2007 XML, Text, Rich Text Format, writer8, HTML (StarWriter), writer_png_Export, writer_jpg_Export
Formula pdf xlsx xlsm csv png jpg calc_pdf_Export, Calc MS Excel 2007 XML, Text - txt - csv (StarCalc), calc_png_Export, calc_jpg_Export, Calc MS Excel 2007 VBA XML
Expo pdf pptx png jpg impress_pdf_Export, Impress MS PowerPoint 2007 XML, impress_png_Export, impress_jpg_Export
Nu pdf svg png jpg pptx drawio draw_pdf_Export, draw_svg_Export, draw_png_Export, draw_jpg_Export
Math mml pdf smf MathML XML (Math), math_pdf_Export

PDF options are LibreOffice's JSON: PageRange, Quality, UseLosslessCompression, ReduceImageResolution, MaxImageResolution and SelectPdfVersion (1 to 3 for PDF/A). Image options are PixelWidth, PixelHeight and Quality. A PNG or JPEG of a text document or workbook is its first page. --infilter=<filter> opens a file with a named filter regardless of its extension.

Formula converts to xlsx, xlsm and csv, and answers --cat, without building its window at all, which makes those conversions faster. A Word 97 .doc converts like any other Impulse document: mos --convert-to docx Old.doc.

Other LibreOffice switches

Switch What it does
--cat <files> Writes each document's text to standard output: plain text from Impulse, with tables as tab-separated rows; CSV of the first sheet from Formula, with dates and times written as the cells show them; and each slide's text from Expo, one block per slide
--print-to-file [--printer-name <name>] [--outdir <dir>] <files> Writes one PDF per document
--headless <file> Opens the document without a window and reports what was lost
--view <file>, --show <file> Opens a document read-only; --show starts the slide show
--norestore Does not offer to recover earlier sessions
--version Prints the version
--language=<tag> Starts in another language
--nologo, --nodefault, --minimized, --nolockcheck, --pidfile, -env: Accepted for compatibility

Running a script

MethodoxFormula --script SummarySheet.lua --open Sales.xlsx --save-as Summary.xlsx
MethodoxExpo --script DeckFromWorkbook.lua --arg Sales.xlsx --save-as Sales.pptx

--script <file.lua|file.csx>, or <graphs.dvj>#<Routine> for a graph Routine, runs a script without a window against the document given with --open (or, with mos, the document named last), or against a new document. --arg <value>, repeatable, passes values the script reads as app.arguments, and --save-as <path> saves the result when the script succeeded. The script's output and errors go to standard output, followed by a line saying how it went.

Exit code Meaning
0 The script succeeded (and the result was saved, with --save-as)
1 The script failed; its changes were rolled back and nothing was saved
2 A mistake on the command line: no such script, a language not supported, --save-as without a document, or switches that cannot go together
3 The document could not be opened
4 The script succeeded but the save failed

--script cannot be combined with --convert-to, --cat or --print-to-file.

Screenshots and appearance

Switch What it does
--host headless --shot <file.png> Opens the document without a window and saves a picture of the window as it would look
--type <text>, --keys <keys> With a headless window, types text or presses keys first, in the order given: --keys "ctrl+shift+q", --keys "pagedown pagedown"
--size <w>x<h>, --scale <n> The window size in pixels, and the display scale
--dark, --high-contrast The dark theme, and the high-contrast theme
--host sdl3\|avalonia\|sfml\|opentk The windowing layer; SDL3 is the default

The pictures on these wiki pages were taken this way, for example:

MethodoxExpo --host headless --size 1440x900 --shot deck.png "Welcome to Methodox Expo.pptx" --keys "pagedown tab tab f2 end" --type " and more"

A show or other second window open at the end is saved beside the main picture as deck.window1.png.