excelT

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCellIndex

func GetCellIndex(row, col int) string

获取索引

func GetColIndex

func GetColIndex(num int) string

获取列索引

func GetSheetList

func GetSheetList(excelFile *excelize.File) []string

读取所有工作表

func GetSheetNameByIndex

func GetSheetNameByIndex(file *excelize.File, index int) string

根据索引获取工作表

func ReWriteSheet

func ReWriteSheet(file *excelize.File, sheetName string)

重写工作表

func RemoveSheet

func RemoveSheet(file *excelize.File, sheetName string)

删除工作表

func RowsToJson

func RowsToJson(rows []*Row) []map[string]string

func RowsToJsonByKey

func RowsToJsonByKey(rows []*Row, keys ...string) map[string]map[string]string

func Save

func Save(file *excelize.File)

保存文件

func SaveAs

func SaveAs(file *excelize.File, filename string)

另存为文件

Types

type Cell

type Cell struct {
	File      *excelize.File
	SheetName string
	Value     string
	RowIndex  int
	ColIndex  int
	Position  string
	// contains filtered or unexported fields
}

单元格

func (*Cell) GetFloatValue

func (cell *Cell) GetFloatValue() float64

获取浮点数

func (*Cell) GetIndent

func (cell *Cell) GetIndent() int

获取缩进

func (*Cell) GetStyle

func (cell *Cell) GetStyle() *excelize.Style

读取单元格样式

func (*Cell) GetType

func (cell *Cell) GetType() string

获取单元格类型 - 应该通过cell.Style获取

func (*Cell) SaveStyle

func (cell *Cell) SaveStyle()

保存单元格样式

func (*Cell) SetCellBoolValue added in v0.0.4

func (cell *Cell) SetCellBoolValue(val bool)

func (*Cell) SetCellIntValue added in v0.0.4

func (cell *Cell) SetCellIntValue(val int)

func (*Cell) SetCellStrValue added in v0.0.4

func (cell *Cell) SetCellStrValue(val string)

func (*Cell) SetCellValue added in v0.0.4

func (cell *Cell) SetCellValue(val any)

func (*Cell) SetComment

func (cell *Cell) SetComment(title, comment string)

func (*Cell) SetFillErrorStyle

func (cell *Cell) SetFillErrorStyle()

func (*Cell) SetFillStyle

func (cell *Cell) SetFillStyle(color string)

func (*Cell) SetFillWarnStyle

func (cell *Cell) SetFillWarnStyle()

颜色填充

func (*Cell) SetFontErrorStyle

func (cell *Cell) SetFontErrorStyle()

func (*Cell) SetFontStyle

func (cell *Cell) SetFontStyle(color string)

func (*Cell) SetFontWarnStyle

func (cell *Cell) SetFontWarnStyle()

字体

func (*Cell) SetIndent

func (cell *Cell) SetIndent(indent int)

设置缩进

type Row

type Row struct {
	Len       int
	RowIndex  int
	Position  string
	File      *excelize.File
	SheetName string
	CellList  []*Cell
}

func ReadRows

func ReadRows(filename string, sheetName string) (*excelize.File, []*Row)

可以读取Excel文件中多个表格的数据

func ReadRowsByIndex

func ReadRowsByIndex(filename string, index int) (*excelize.File, []*Row)

读取Excel文件,通过索引读取

func (*Row) GetCellByColIndex

func (r *Row) GetCellByColIndex(colIndex int) *Cell

根据列索引获取单元格

func (*Row) InsertCol

func (r *Row) InsertCol(col string)

func (*Row) InsertCols

func (r *Row) InsertCols(col string, num int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL