xlsx

package
v0.0.0-...-d31700d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(sheets ...Sheet) (*xlsx.File, error)

func GetValue

func GetValue(value reflect.Value, names []string) (interface{}, bool)

func SetGetters

func SetGetters(columns []Column, getters map[string]func(row interface{}) interface{})

func Write

func Write(w io.Writer, sheets ...Sheet) error

func WriteFile

func WriteFile(path string, sheets ...Sheet) error

func WriteHttp

func WriteHttp(rw http.ResponseWriter, name string, sheets ...Sheet) error

Types

type Column

type Column struct {
	Label  string                            `json:"label" c:"标签(显示名称)"`
	Prop   string                            `json:"prop"  c:"属性(字段名称)"`
	Width  float64                           `json:"width" c:"宽度"`
	Getter func(row interface{}) interface{} `json:"-"`
	// contains filtered or unexported fields
}

func (*Column) GetValue

func (c *Column) GetValue(row reflect.Value) (interface{}, bool)

type Sheet

type Sheet struct {
	Name    string
	Data    interface{}
	Columns []Column
}

func (*Sheet) Generate

func (s *Sheet) Generate(file *xlsx.File) error

Jump to

Keyboard shortcuts

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