Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GExcel ¶
GExcel ... 自定义Excel
func (GExcel) OpenAsColumn2Map ¶
OpenAsColumn2Map ... 打开Excel,需要先执行Save的demo保存一波
rr := gexcel.GExcel{ FileName: "test.xlsx", SheetName: "Sheet1", }.OpenAsColumn2Map() bt, _ := json.Marshal(rr) fmt.Println(string(bt))
func (GExcel) OpenAsColumn2Slice ¶
OpenAsColumn2Slice ... 打开Excel
func (GExcel) Save ¶
func (xlsx GExcel) Save()
Save ... 保存Excel
header := []string{} data := [][]string{} rowData := []string{} for i := 1; i < 10; i++ { header = append(header, fmt.Sprintf("第 %d 列", i)) rowData = append(rowData, fmt.Sprintf("col value %d", i)) } for i := 1; i < 10; i++ { data = append(data, rowData) } xlsx := gexcel.GExcel{ FileName: "test.xlsx", SheetName: "Sheet1", Header: header, Data: data, } xlsx.Save()
Click to show internal directories.
Click to hide internal directories.