27 lines
510 B
Go
27 lines
510 B
Go
![]() |
package lib
|
||
|
|
||
|
import "testing"
|
||
|
|
||
|
func TestNewExcel(t *testing.T) {
|
||
|
content := make([]interface{}, 0)
|
||
|
|
||
|
for i := 0; i < 2; i++ {
|
||
|
content = append(content, []interface{}{
|
||
|
"戴恒顺", i + 1 + 1,
|
||
|
})
|
||
|
}
|
||
|
excel := NewExcel(WithExcelName("测试"), WithExcelSheet("专家信息"),
|
||
|
WithExcelTitle([]string{"姓名", "年龄"}), WithExcelContent(&ExcelContent{
|
||
|
Kind: 0,
|
||
|
Content: content,
|
||
|
}))
|
||
|
err := excel.Export()
|
||
|
|
||
|
if err != nil {
|
||
|
t.Log(err)
|
||
|
return
|
||
|
}
|
||
|
err = excel.Save("./lib")
|
||
|
t.Log(err)
|
||
|
}
|