odf

package
v0.0.0-...-1ecfe31 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArchive = errors.New("archiveErr")
View Source
var ErrMimetype = errors.New("mimetypeErr")

TODO: Improve text.

View Source
var ErrOverride = errors.New("overrideErr")
View Source
var ErrUpdateRootMediaType = errors.New("couldn't find and update root media-type")

Functions

This section is empty.

Types

type Odf

type Odf struct {
	// contains filtered or unexported fields
}

func New

func New(doc io.ReaderAt, size int64) (*Odf, error)

NewTemplate returns an ODF instance for the given document with the given size. The file is validated to be a valid ODF package but no content or structure is processed.

func NewFromFile

func NewFromFile(path string) (*Odf, error)

NewFromFile returns a new ODF instance for the given document file path. The file is validated to be a valid ODF package but no content or structure is processed.

func (*Odf) Close

func (o *Odf) Close() error

func (*Odf) InitScript

func (o *Odf) InitScript() string

func (*Odf) MIMEType

func (o *Odf) MIMEType() string

func (*Odf) Open

func (o *Odf) Open(name string) (fs.File, error)

func (*Odf) ValidateAndSetMIMEType

func (o *Odf) ValidateAndSetMIMEType() error

https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part2-packages/OpenDocument-v1.3-os-part2-packages.pdf The file is validated to be a valid ODF package and the MIME type is set accordingly. No content or structure is processed.

func (*Odf) Write

func (o *Odf) Write(w io.Writer, ov Overrides) error

Writes an ODF package to the given writer. It will use the loaded ODF contents as base and incorporate the overrides. It handles the mimetype and manifest.xml.

type Override

type Override struct {
	Data   []byte // File contents to write
	Delete bool   // Do not write file with the given path to the package
}

Override represents a content override for a file.

type Overrides

type Overrides map[string]Override

Overrides defines an override identified by the file path as map key.

Jump to

Keyboard shortcuts

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