cetak

package
v0.0.0-...-814efbb Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cetak helps you generate Word document (.docx) from a template.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Docx

type Docx interface {
	Generate(data interface{}, destination string) error
	Template() *template.Template
	SetTemplate(tpl *template.Template)
}

Docx is the interface used to interact with cetak's doc generator

Generate generates the document using given data. Generate receive data which can be any type that is accepted by text/template package. Generate also receive destination path which is the intended path to write the result. You can also get the generated template and modify it accordingly using the provided getter and setter (Template and SetTemplate)

func New

func New(templatePath string) (Docx, error)

New creates a new Docx object. It will return error if template file could not be opened.

Jump to

Keyboard shortcuts

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