odt

package module
v0.0.0-...-de98364 Latest Latest
Warning

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

Go to latest
Published: May 2, 2021 License: MIT Imports: 4 Imported by: 0

README

odt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	Elements    []DocElement
	PreRendered []byte
}

func (*Content) Add

func (c *Content) Add(elements ...DocElement) *Content

func (*Content) Write

func (c *Content) Write(w zipWriter) error

type DefaultStyle

type DefaultStyle struct {
	Style
}

func (*DefaultStyle) Key

func (ds *DefaultStyle) Key() string

type DocComponent

type DocComponent interface{ Write(zipWriter) error }

type DocElement

type DocElement interface {
	Write() []byte
	String() string
}

type Document

type Document struct {
	Components []DocComponent

	MetaInf  MetaInf
	Pictures Pictures
	Content  Content
	//Manifest Manifest
	//Meta     Meta
	//Mimetype Mimetype
	Settings Settings
	Styles   *Styles
	Fonts    []Font
}

func NewDocument

func NewDocument(styles *Styles) *Document

func (*Document) Add

func (d *Document) Add(elements ...DocElement) *Document

func (*Document) Bytes

func (d *Document) Bytes() ([]byte, error)

func (*Document) Write

func (d *Document) Write(fileName string) error

type Font

type Font struct {
	Name          string
	Family        string
	FamilyGeneric string
	Charset       string
	Pitch         string
}

func (*Font) String

func (f *Font) String() string

type Image

type Image struct {
	FileName  string
	StyleName string
	// contains filtered or unexported fields
}

func NewImage

func NewImage(blob []byte, name string) *Image

func (*Image) String

func (p *Image) String() string

func (*Image) Write

func (p *Image) Write() []byte
type Link struct {
	Text             []DocElement
	StyleName        string
	VisitedStyleName string
	URL              string
}
func NewLink(url string, elements ...DocElement) *Link

func (*Link) String

func (l *Link) String() string

func (*Link) WithStyle

func (l *Link) WithStyle(styleNames ...string) *Link

func (*Link) Write

func (l *Link) Write() []byte

type Manifest

type Manifest struct{}

func (*Manifest) Write

func (m *Manifest) Write(w zipWriter) error

type Meta

type Meta struct{}

func (*Meta) Write

func (m *Meta) Write(w zipWriter) error

type MetaInf

type MetaInf struct{}

func (*MetaInf) Write

func (m *MetaInf) Write(w zipWriter) error

type Mimetype

type Mimetype struct{}

func (*Mimetype) Write

func (m *Mimetype) Write(w zipWriter) error

type Paragraph

type Paragraph struct {
	Content   []DocElement
	StyleName string
}

func NewLineBrake

func NewLineBrake() *Paragraph

func NewLinkParagraph

func NewLinkParagraph(url, text string) *Paragraph

func NewParagraph

func NewParagraph(content ...DocElement) *Paragraph

func NewTextParagraph

func NewTextParagraph(text string) *Paragraph

func (*Paragraph) Add

func (p *Paragraph) Add(elements ...DocElement) *Paragraph

func (*Paragraph) String

func (p *Paragraph) String() string

func (*Paragraph) WithStyle

func (p *Paragraph) WithStyle(styleName string) *Paragraph

func (*Paragraph) Write

func (p *Paragraph) Write() []byte

type Pictures

type Pictures struct {
	Items []*Image
}

func (*Pictures) Add

func (p *Pictures) Add(images ...*Image)

func (*Pictures) Write

func (p *Pictures) Write(w zipWriter) error

type Settings

type Settings struct{}

func (*Settings) Write

func (s *Settings) Write(w zipWriter) error

type Span

type Span struct {
	StyleName string
	Text      string
}

func NewSpan

func NewSpan(text string, styleName ...string) *Span

func (*Span) String

func (s *Span) String() string

func (*Span) WithStyle

func (s *Span) WithStyle(styleName string) *Span

func (*Span) Write

func (s *Span) Write() []byte

type Style

type Style struct {
	Name   string
	Family string
	Class  string
	Parent *Style
	Next   *Style

	ParagraphProperties  map[string]string
	TextProperties       map[string]string
	TableProperties      map[string]string
	TableRowProperties   map[string]string
	ListLevelProperties  map[string]string
	PageLayoutProperties map[string]string
}

func (*Style) Key

func (s *Style) Key() string

func (*Style) String

func (s *Style) String() string

type StyleElement

type StyleElement interface {
	Key() string
	String() string
}

type Styles

type Styles []StyleElement

func NewStyles

func NewStyles() *Styles

func (*Styles) Add

func (ss *Styles) Add(styles ...StyleElement) *Styles

func (*Styles) Write

func (ss *Styles) Write(w zipWriter) error

type Table

type Table struct {
	Rows      []*TableRow
	StyleName string
}

func NewTable

func NewTable(rows ...*TableRow) *Table

func (*Table) String

func (t *Table) String() string

<table:table-column table:style-name="Table3.A"/> <table:table-column table:style-name="Table3.B"/>

func (*Table) Write

func (t *Table) Write() []byte

type TableCell

type TableCell struct {
	Items     []DocElement
	StyleName string
}

func NewTextTableCell

func NewTextTableCell(text string) *TableCell

func (*TableCell) String

func (c *TableCell) String() string

func (*TableCell) WithStyle

func (c *TableCell) WithStyle(styleName string) *TableCell

type TableRow

type TableRow struct {
	Cells     []*TableCell
	StyleName string
}

func NewTableRow

func NewTableRow(cells ...*TableCell) *TableRow

func (*TableRow) String

func (r *TableRow) String() string

func (*TableRow) WithStyle

func (r *TableRow) WithStyle(styleName string) *TableRow

Jump to

Keyboard shortcuts

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