Help us shape the future of Go! Take the 2026 Go Developer Survey

office

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package office runs LibreOffice headless to see a file the way another office app does: one soffice run converts a batch of files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(ctx context.Context, soffice string, files map[string][]byte, filter string) (map[string][]byte, error)

Convert writes files to a private folder, converts them all in one run to the filter (such as "pdf" or a csv filter with options) and returns every file LibreOffice wrote, by name. A private profile keeps parallel runs and the user's own LibreOffice apart.

func Find

func Find() (string, error)

Find locates LibreOffice's soffice: LFM_SOFFICE (a path, or none to turn it off for lfm's own tests), PATH, or the usual install locations.

func HasExcel

func HasExcel() bool

HasExcel reports whether Microsoft Excel for Mac is installed.

func HasPowerPoint

func HasPowerPoint() bool

HasPowerPoint reports whether Microsoft PowerPoint for Mac is installed.

func HasWord

func HasWord() bool

HasWord reports whether Microsoft Word for Mac is installed.

func Missing

func Missing(err error) bool

Missing reports whether err means LibreOffice is not there, which no release needs: its checks are a second opinion.

func OpenInExcel

func OpenInExcel(files map[string][]byte) (map[string]Opened, error)

OpenInExcel opens each .xlsx in Excel, recalculates every formula and returns the workbook as Excel saved it, with Excel's values.

func OpenInPowerPoint

func OpenInPowerPoint(files map[string][]byte) (map[string]Opened, error)

OpenInPowerPoint opens each .pptx in PowerPoint as a buyer would and returns its slide count and PowerPoint's PDF of it.

func OpenInWord

func OpenInWord(files map[string][]byte) (map[string]Opened, error)

OpenInWord opens each .docx in Word as a buyer would and returns its page count and Word's PDF of it.

Types

type Opened

type Opened struct {
	Result string // what the script returned: Word's page count
	Data   []byte // what the app wrote: Word's PDF, Excel's recalculated workbook
	Error  string // why the app could not open it as is
}

Opened is a file as a Microsoft Office app for Mac opened it.

Jump to

Keyboard shortcuts

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