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 ¶
- func Convert(ctx context.Context, soffice string, files map[string][]byte, filter string) (map[string][]byte, error)
- func Find() (string, error)
- func HasExcel() bool
- func HasPowerPoint() bool
- func HasWord() bool
- func Missing(err error) bool
- func OpenInExcel(files map[string][]byte) (map[string]Opened, error)
- func OpenInPowerPoint(files map[string][]byte) (map[string]Opened, error)
- func OpenInWord(files map[string][]byte) (map[string]Opened, error)
- type Opened
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 ¶
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 HasPowerPoint ¶
func HasPowerPoint() bool
HasPowerPoint reports whether Microsoft PowerPoint for Mac is installed.
func Missing ¶
Missing reports whether err means LibreOffice is not there, which no release needs: its checks are a second opinion.
func OpenInExcel ¶
OpenInExcel opens each .xlsx in Excel, recalculates every formula and returns the workbook as Excel saved it, with Excel's values.
func OpenInPowerPoint ¶
OpenInPowerPoint opens each .pptx in PowerPoint as a buyer would and returns its slide count and PowerPoint's PDF of it.