Documentation ¶
Index ¶
- type Service
- func (s *Service) DownloadFile(w http.ResponseWriter)
- func (s *Service) InitColStyle()
- func (s *Service) InitFile()
- func (s *Service) InitStreamWrite() *Service
- func (s *Service) SaveFile() (string, error)
- func (s *Service) StreamClose() error
- func (s *Service) StreamWriteByListData(listData [][]interface{}) *Service
- func (s *Service) StreamWriteByMapData(mapData []map[interface{}]interface{}) *Service
- func (s *Service) StreamWriteByRowData(rowData []interface{}) *Service
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) StreamWriteByListData ¶
流式写入(行数据列表,需自定义顺序)
func (*Service) StreamWriteByMapData ¶
流式写入(map结构体数据,按表头顺序写)
func (*Service) StreamWriteByRowData ¶
流式写入(单行数据,需自定义顺序)
Click to show internal directories.
Click to hide internal directories.