officecmd

package
v0.60.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package officecmd reads the command line an app hands the office engine.

Until filex 0.50 the office engine was LibreOffice, and an app ran it the way one runs soffice: `--convert-to <format>[:<filter>[:<options>]] <file>`. Since 0.50 the office engine is the OnlyOffice Document Server filex is connected to, and filex reads that same command line as a conversion: the target format, PDF/A when LibreOffice's PDF options ask for it, the CSV separator and character set when its CSV options name them. An app built for LibreOffice runs unchanged; a new app writes the same line.

The host (internal/wasmplugin) and the test host (plugintest) both read it here, so an app's tests refuse exactly what filex refuses.

Index

Constants

View Source
const (
	Engine       = "office"
	LegacyEngine = "libreoffice"
)

The office engine's names: Engine since 0.50, LegacyEngine (its name while it was LibreOffice) still accepted for the same engine - the permission `engines:libreoffice` grants `engines:office` and the other way round.

Variables

This section is empty.

Functions

func IsEngine

func IsEngine(name string) bool

IsEngine reports whether name is the office engine under either name.

func OutputName

func OutputName(in, to string) string

OutputName is the name a result gets: the input's stem and the target extension, the name soffice gave it (`in.docx` → `in.pdf`).

func PreparingMessage added in v0.60.0

func PreparingMessage(engine string) string

PreparingMessage is the host's answer while the office engine an app brings is still being compiled (once after it is installed or updated, a few minutes) and no Document Server takes the job meanwhile: classified as `office_preparing`.

func UnconfiguredMessage added in v0.60.0

func UnconfiguredMessage(engine string) string

UnconfiguredMessage is the host's answer when the office engine is asked for and nothing here converts office documents: no app brings an office engine and no Document Server is connected. It names the remedy, which is not "install a program"; the host classifies a job that fails on it as `office_unconfigured` (its sentence in the person's language). The host and the test host (plugintest) say the same words.

Types

type Command

type Command struct {
	// To is the target format, an extension ("pdf", "docx", "csv").
	To string
	// PDFA: LibreOffice's PDF options asked for a PDF/A version (1, 2 or 3).
	// The document server makes one kind of PDF/A (PDF/A-2a on 9.4).
	PDFA bool
	// Delimiter and CodePage are the conversion API's CSV knobs, read from
	// LibreOffice's CSV options (0 = not said).
	Delimiter int
	CodePage  int
	// Inputs are the files to convert, by their names in the run directory.
	Inputs []string
}

Command is a command line read as a conversion.

func Parse

func Parse(args []string) (*Command, error)

Parse reads a command line. The error says what is wrong in a sentence an app's author can act on.

func (*Command) OutputType

func (c *Command) OutputType() string

OutputType is what the document server is asked to make: To, or "pdfa".

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL