Documentation ¶
Index ¶
- Variables
- func NilReplacerFunc(_ string) (string, bool)
- type Char
- type CharList
- func (l *CharList) Current() *Char
- func (l *CharList) GoToFirst()
- func (l *CharList) Insert(r *Char)
- func (l *CharList) InsertBefore(r *Char)
- func (l *CharList) Len() int
- func (l *CharList) LoadFromElement(con *xml.UniversalElement)
- func (l *CharList) LookAhead(t int) string
- func (l *CharList) LookAheadTill(delim string) (string, error)
- func (l *CharList) Next() *Char
- func (l *CharList) Prev() *Char
- func (l *CharList) Remove(t int) error
- func (l *CharList) Replace(rf ReplacerFunc) error
- func (l *CharList) Seek(t int)
- func (l *CharList) SeekTill(delim string) error
- func (l *CharList) String() string
- func (l *CharList) ToParagraphList() []*xml.UniversalElement
- type CharNode
- type DocImage
- type DocImageList
- type Docx
- func (d *Docx) Replace(f ReplacerFunc) error
- func (d *Docx) ReplaceImageByFingerPrint(oldImageFingerprint string, newImage io.Reader) (err error)
- func (d *Docx) ReplaceImageByImageName(oldImageName string, newImage io.Reader) (err error)
- func (d *Docx) Save(ioWriter io.Writer) (err error)
- func (d *Docx) WriteToFile(path string) (err error)
- type Paragraph
- type Processor
- func (p *Processor) LoadAndReplace(inp []byte, f ReplacerFunc) ([]byte, error)
- func (p *Processor) LoadElement(doc *xml.UniversalElement)
- func (p *Processor) ProccessReplace(con *xml.UniversalElement, repf ReplacerFunc) error
- func (p *Processor) Replace(repfunc ReplacerFunc) ([]byte, error)
- func (p *Processor) WalkAndReplace(start *xml.UniversalElement, repf ReplacerFunc) error
- type ReplacerFunc
- type Template
- type TemplateExecuteExtension
Constants ¶
This section is empty.
Variables ¶
View Source
var ( StartPlace = "{{" EndPlace = "}}" )
Functions ¶
func NilReplacerFunc ¶ added in v1.1.3
Types ¶
type Char ¶
type Char struct { Rune rune T *xml.UniversalElement R *xml.UniversalElement P *xml.UniversalElement }
type CharList ¶
func (*CharList) InsertBefore ¶
func (*CharList) LoadFromElement ¶
func (l *CharList) LoadFromElement(con *xml.UniversalElement)
func (*CharList) Replace ¶
func (l *CharList) Replace(rf ReplacerFunc) error
func (*CharList) ToParagraphList ¶
func (l *CharList) ToParagraphList() []*xml.UniversalElement
type DocImage ¶ added in v1.1.1
func NewDocImage ¶ added in v1.1.2
type DocImageList ¶ added in v1.1.1
func (DocImageList) Has ¶ added in v1.1.1
func (d DocImageList) Has(fingerprint string) bool
type Docx ¶
type Docx struct {
// contains filtered or unexported fields
}
func NewDocxFromStream ¶ added in v1.1.2
NewDocxFromFile creates a new Docx from a io.ReaderAt
func (*Docx) Replace ¶
func (d *Docx) Replace(f ReplacerFunc) error
Replace replaces all occurrences of the given string with the given string
func (*Docx) ReplaceImageByFingerPrint ¶ added in v1.1.1
func (d *Docx) ReplaceImageByFingerPrint(oldImageFingerprint string, newImage io.Reader) (err error)
ReplaceImageByFingerPrint replaces the image with the given fingerprint
func (*Docx) ReplaceImageByImageName ¶ added in v1.1.1
ReplaceImageByImageName replaces the image with the given name
func (*Docx) WriteToFile ¶ added in v1.1.0
WriteToFile writes the docx file to the given path
type Paragraph ¶
type Paragraph struct { ControlR *xml.UniversalElement ControlT *xml.UniversalElement xml.UniversalElement }
func NewParagraph ¶
func NewParagraph(p, r, t *xml.UniversalElement) *Paragraph
func (*Paragraph) ToUniversal ¶
func (p *Paragraph) ToUniversal() *xml.UniversalElement
type Processor ¶
type Processor struct {
Document *xml.UniversalElement
}
func (*Processor) LoadAndReplace ¶
func (p *Processor) LoadAndReplace(inp []byte, f ReplacerFunc) ([]byte, error)
func (*Processor) LoadElement ¶
func (p *Processor) LoadElement(doc *xml.UniversalElement)
func (*Processor) ProccessReplace ¶
func (p *Processor) ProccessReplace(con *xml.UniversalElement, repf ReplacerFunc) error
func (*Processor) WalkAndReplace ¶
func (p *Processor) WalkAndReplace(start *xml.UniversalElement, repf ReplacerFunc) error
type ReplacerFunc ¶
func NewStructReplacerFunc ¶ added in v1.1.2
func NewStructReplacerFunc(model interface{}) (ReplacerFunc, error)
type Template ¶
type Template struct {
File *Docx
}
func (*Template) ExecuteToPDF ¶
func (t *Template) ExecuteToPDF(model interface{}, exts ...TemplateExecuteExtension) ([]byte, error)
func (*Template) ExecuteToWriter ¶
func (t *Template) ExecuteToWriter(model interface{}, writer io.Writer, exts ...TemplateExecuteExtension) error
type TemplateExecuteExtension ¶ added in v1.1.2
func WithImageReplaceByFingerprint ¶ added in v1.1.2
func WithImageReplaceByFingerprint(ims map[string]io.Reader) TemplateExecuteExtension
func WithImageReplaceByName ¶ added in v1.1.2
func WithImageReplaceByName(ims map[string]io.Reader) TemplateExecuteExtension
Click to show internal directories.
Click to hide internal directories.