4.1. 设置单元格的值
单元格
RichTextRun 定义了富文本的属性。
type RichTextRun struct {
Font *Font
Text string
}
HyperlinkOpts 用来指定可选的超链接属性,例如要显示的文字与屏幕提示文字。
type HyperlinkOpts struct {
Display *string
Tooltip *string
}
FormulaOpts 用于在 SetCellFormula
函数中指定设置特殊公式类型。
type FormulaOpts struct {
Type *string // 公式类型
Ref *string // 共享公式引用
}
设置单元格的值
func (f *File) SetCellValue(sheet, axis string, value interface{}) error
根据给定的工作表名和单元格坐标设置单元格的值。指定的坐标不应在表格的第一行范围,使用字符文本设置复数。
支持的数据类型 |
---|
int |
int8 |
int16 |
int32 |
int64 |
uint |
uint8 |
uint16 |
uint32 |
uint64 |
float32 |
float64 |
string |
[]byte |
time.Duration |
time.Time |
bool |
nil |