Documentation ¶
Overview ¶
Package tplx implements data-driven templates for generating ooxml files.
Index ¶
- Constants
- type Rel
- type Rels
- type Template
- func (a *Template) ExecuteBytes(data any) ([]byte, error)
- func (a *Template) ExecuteFile(name string, data any) error
- func (a *Template) ExecuteWriter(w io.Writer, data any) error
- func (a *Template) ExecuteZIP(zw *zip.Writer, data any) error
- func (a *Template) Funcs(funcs map[string]any) *Template
- func (a *Template) ParseBytes(ftype Type, bs []byte) error
- func (a *Template) ParseFile(name string) error
- func (a *Template) ParseReader(ftype Type, r io.Reader) error
- func (a *Template) ParseZIP(ftype Type, zr *zip.Reader) error
- type Type
Constants ¶
const ( DOCX = ".docx" XLSX = ".xlsx" PPTX = ".pptx" )
File types.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template is the representation of a parsed template.
func (*Template) ExecuteBytes ¶
ExecuteBytes applies a parsed template to the specified data object, and return as bytes.
func (*Template) ExecuteFile ¶
ExecuteFile applies a parsed template to the specified data object, and writes the output to the file.
func (*Template) ExecuteWriter ¶
ExecuteWriter applies a parsed template to the specified data object, and writes the output to the writer.
func (*Template) ExecuteZIP ¶
ExecuteZIP applies a parsed template to the specified data object, and writes the output to the zip writer.
func (*Template) Funcs ¶
Funcs adds the elements of the argument map to the template's function map.
func (*Template) ParseBytes ¶
ParseBytes parses the bytes as a template.
func (*Template) ParseReader ¶
ParseReader parses the reader as a template.