设置样式:

package main

import (
    "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", "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

相关文章:

  • 2021-12-05
  • 2021-12-05
  • 2021-12-05
  • 2021-06-14
  • 2021-10-19
  • 2021-11-23
  • 2022-01-05
猜你喜欢
  • 2022-12-23
  • 2021-09-27
  • 2021-09-27
  • 2021-10-01
  • 2021-04-13
相关资源
相似解决方案