odf

package
v0.0.0-...-e8b0599 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ISO8601 = "2006-01-02T15:04:05"
)
View Source
const (
	MimeTypePfx = "application/vnd.oasis.opendocument."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DocStats

type DocStats struct {
	Tables     int `xml:"table-count,attr"`
	Cells      int `xml:"cell-count,attr"`
	Images     int `xml:"image-count,attr"`
	Objects    int `xml:"object-count,attr"`
	Pages      int `xml:"page-count,attr"`
	Paragraphs int `xml:"paragraph-count,attr"`
	Words      int `xml:"word-count,attr"`
	Characters int `xml:"character-count,attr"`
}

type DocumentMeta

type DocumentMeta struct {
	XMLName xml.Name `xml:"urn:oasis:names:tc:opendocument:xmlns:office:1.0 document-meta"`

	Version string `xml:"office version,attr"`
	Meta    Meta   `xml:"meta"`
}

type File

type File struct {
	*zip.Reader

	MimeType string
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.ReaderAt, size int64) (*File, error)

NewReader initializes a File struct with an already opened ODF file, and checks the file's MIME type. The returned *File provides access to files embedded in the ODF file, like content.xml.

func Open

func Open(odfName string) (*File, error)

Open an OpenDocument file for reading, and check its MIME type. The returned *File provides -- via its Open method -- access to files embedded in the ODF, like content.xml.

func (*File) Close

func (f *File) Close() error

func (*File) Meta

func (f *File) Meta() (docMeta *DocumentMeta, err error)

func (*File) Open

func (f *File) Open(name string) (io.ReadCloser, error)

type Meta

type Meta struct {
	Title string `xml:"title"`

	InitialCreator Time `xml:"initial-creator"`
	CreationDate   Time `xml:"creation-date"`

	DcCreator string `xml:"dc creator"`
	DcDate    string `xml:"dc date"`
	DcLang    string `xml:"dc language"`

	EditingCycles   int    `xml:"editing-cycles"`
	EditingDuration string `xml:"editing-duration"`

	Stats DocStats `xml:"document-statistic"`

	Generator string `xml:"generator"`

	UserDefined []struct {
		Name string `xml:"name,attr"`
		Text string `xml:",chardata"`
	} `xml:"user-defined"`
}

type Time

type Time string

func (Time) Time

func (s Time) Time() (t time.Time, err error)

Jump to

Keyboard shortcuts

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