excel

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MulanPSL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	FileSavePath string                      // 文件保存路径
	FileName     string                      // 文件名
	FileFullPath string                      // 文件全路径
	SheetName    string                      // 工作簿
	StreamWriter *excelize.StreamWriter      // 流式写入
	File         *excelize.File              // 操作文件
	Headers      []interface{}               // 表头(用于指定数据顺序),如["用户ID", "名称", "年龄"]
	HeadersKey   []interface{}               // 表头key切片,如["id", "name"]
	HeadersMap   map[interface{}]interface{} // 表头Map,如map["value"] = "表头"
	RowLastIndex int                         // 最后一行索引
	IsDownload   bool                        // 是否下载:false-否(保存文件);true-下载文件
}

func (*Service) DownloadFile

func (s *Service) DownloadFile(w http.ResponseWriter)

下载文件

func (*Service) InitColStyle

func (s *Service) InitColStyle()

初始化单元格样式(默认)

func (*Service) InitFile

func (s *Service) InitFile()

初始化表格文件

func (*Service) InitStreamWrite

func (s *Service) InitStreamWrite() *Service

初始化流式写入

func (*Service) SaveFile

func (s *Service) SaveFile() (string, error)

保存文件

func (*Service) StreamClose

func (s *Service) StreamClose() error

结束流式写入

func (*Service) StreamWriteByListData

func (s *Service) StreamWriteByListData(listData [][]interface{}) *Service

流式写入(行数据列表,需自定义顺序)

func (*Service) StreamWriteByMapData

func (s *Service) StreamWriteByMapData(mapData []map[interface{}]interface{}) *Service

流式写入(map结构体数据,按表头顺序写)

func (*Service) StreamWriteByRowData

func (s *Service) StreamWriteByRowData(rowData []interface{}) *Service

流式写入(单行数据,需自定义顺序)

Jump to

Keyboard shortcuts

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