设置样式:
package mainimport ( "github.com/tealeg/xlsx" "fmt")func main() { var file *xlsx.file var sheet *xlsx.Sheet var row *xlsx.Row var cell *xlsx.Cell var err error style := xlsx.NewStyle() fill := *xlsx.NewFill("solID","00FF0000","FF000000") Font := *xlsx.NewFont(20,"Verdana") border := *xlsx.Newborder("thin","thin","thin") style.Fill = fill style.Font = Font style.border = border style.ApplyFill = true style.ApplyFont = true style.Applyborder = true file = xlsx.Newfile() sheet,_ = file.AddSheet("Sheetname") row = sheet.AddRow() cell = row.AddCell() cell.Value = "100000" cell.SetStyle(style) cell = row.AddCell() cell.Value = "test" err = file.Save("test.xlsx") if err != nil { fmt.Printf(err.Error()) }}
发送到浏览器: https://blog.csdn.net/nIEchaoya/article/details/46470715
想法: 先把数据组织成一个二维数组 [ [ua ua ua ub ub ub uc uc uc ] [] [] ] 用swith
总结以上是内存溢出为你收集整理的golang导出Excel表格全部内容,希望文章能够帮你解决golang导出Excel表格所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)