初学go报错cannot use '\u0000' (type rune) as type string

package main

 import (
     "github.com/tealeg/xlsx"
 )

 func main() {
     file, err := xlsx.OpenFile("./Workbook.xlsx")
     if err != nil {
         panic(err)
     }
     first := file.Sheets[0]
     row := first.AddRow()
     row.SetHeightCM(1)
     cell := row.AddCell()
     cell.Value = "1"
     cell = row.AddCell()
     cell.Value = "张三"
     cell = row.AddCell()
     cell.Value = "男"
     cell = row.AddCell()
     cell.Value = "18"

     err = file.Save('./Workbook.xlsx')
     if err != nil {
         panic(err)
     }

 }
阅读 10.5k
1 个回答

字符串用双引号,单引号是rune类型

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题