ooxml

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MainDocumentContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"
View Source
const OpenxmlNamespace = "http://schemas.openxmlformats.org/package/2006/content-types"

Variables

View Source
var ErrArchive = errors.New("archiveErr")
View Source
var ErrContentTypeValidation = errors.New(" of ooxml in invalid")
View Source
var ErrMimetype = errors.New("mimetypeErr")

TODO: Improve text.

View Source
var ErrOverride = errors.New("overrideErr")
View Source
var ErrUnexpectedTokenType = errors.New("unexpected token type")

Functions

This section is empty.

Types

type OOXML

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

ODF defines an OpenDocument file that is concurrently accessible.

func New

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

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

func NewFromFile

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

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

func (*OOXML) Close

func (o *OOXML) Close() error

Close needs to be called at the end of the document processing to release any allocated resources.

func (*OOXML) InitScript

func (o *OOXML) InitScript() string

func (*OOXML) MIMEType

func (o *OOXML) MIMEType() string

func (*OOXML) Open

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

Opens the given file as fs.File.

func (*OOXML) ValidateAndSetMIMEType

func (o *OOXML) ValidateAndSetMIMEType() error

http://officeopenxml.com/anatomyofOOXML.php

func (*OOXML) Write

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

Writes an OOXML package to the given writer. It will use the loaded OOXML contents as base and incorporate the overrides.

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