excel

package
v2.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 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 ColumnNumberToText

func ColumnNumberToText(columnNumber int) (string, error)

ColumnNumberToText 列索引转文字

func ColumnTextToNumber

func ColumnTextToNumber(columnText string) int

ColumnTextToNumber 列文字转索引

Types

type ExcelCell

type ExcelCell struct {
	// contains filtered or unexported fields
}

ExcelCell Excel单元格

func NewExcelCellAny

func NewExcelCellAny(content any) *ExcelCell

NewExcelCellAny 构造函数(字符串格式)

func NewExcelCellBool

func NewExcelCellBool(content bool) *ExcelCell

NewExcelCellBool 构造函数(布尔格式)

func NewExcelCellFloat64

func NewExcelCellFloat64(content float64) *ExcelCell

NewExcelCellFloat64 构造函数(小数格式)

func NewExcelCellFormula

func NewExcelCellFormula(content string) *ExcelCell

NewExcelCellFormula 构造函数(公式格式)

func NewExcelCellInt

func NewExcelCellInt(content int) *ExcelCell

NewExcelCellInt 构造函数(整数格式)

func (*ExcelCell) GetContent

func (r *ExcelCell) GetContent() any

GetContent 获取内容

func (*ExcelCell) GetContentType

func (r *ExcelCell) GetContentType() ExcelCellContentType

GetContentType 获取单元格类型

func (*ExcelCell) GetCoordinate

func (r *ExcelCell) GetCoordinate() string

GetCoordinate 获取单元格坐标

func (*ExcelCell) GetFontBold

func (r *ExcelCell) GetFontBold() bool

GetFontBold 获取字体粗体

func (*ExcelCell) GetFontColor

func (r *ExcelCell) GetFontColor() string

GetFontColor 获取字体颜色

func (*ExcelCell) GetFontFamily

func (r *ExcelCell) GetFontFamily() string

GetFontFamily 获取字体

func (*ExcelCell) GetFontItalic

func (r *ExcelCell) GetFontItalic() bool

GetFontItalic 获取字体斜体

func (*ExcelCell) GetFontSize

func (r *ExcelCell) GetFontSize() float64

GetFontSize 获取字体字号

func (*ExcelCell) Init

func (r *ExcelCell) Init(content any) *ExcelCell

Init 初始化

func (*ExcelCell) SetContent

func (r *ExcelCell) SetContent(content any) *ExcelCell

SetContent 设置内容

func (*ExcelCell) SetContentType

func (r *ExcelCell) SetContentType(contentType ExcelCellContentType) *ExcelCell

SetContentType 设置单元格类型

func (*ExcelCell) SetCoordinate

func (r *ExcelCell) SetCoordinate(coordinate string) *ExcelCell

SetCoordinate 设置单元格坐标

func (*ExcelCell) SetFontBold

func (r *ExcelCell) SetFontBold(fontBold bool, condition bool) *ExcelCell

SetFontBold 设置字体粗体

func (*ExcelCell) SetFontColor

func (r *ExcelCell) SetFontColor(fontColor string, condition bool) *ExcelCell

SetFontColor 设置字体颜色

func (*ExcelCell) SetFontFamily

func (r *ExcelCell) SetFontFamily(fontFamily string, condition bool) *ExcelCell

SetFontFamily 设置字体

func (*ExcelCell) SetFontItalic

func (r *ExcelCell) SetFontItalic(fontItalic bool, condition bool) *ExcelCell

SetFontItalic 设置字体斜体

func (*ExcelCell) SetFontSize

func (r *ExcelCell) SetFontSize(fontSize float64) *ExcelCell

SetFontSize 设置字体字号

type ExcelCellContentType

type ExcelCellContentType string

ExcelCellContentType 单元格内容类型

const (
	ExcelCellContentTypeAny     ExcelCellContentType = "any"
	ExcelCellContentTypeFormula ExcelCellContentType = "formula"
	ExcelCellContentTypeInt     ExcelCellContentType = "int"
	ExcelCellContentTypeFloat64 ExcelCellContentType = "float64"
	ExcelCellContentTypeBool    ExcelCellContentType = "bool"
)

type ExcelReader

type ExcelReader struct {
	// contains filtered or unexported fields
}

ExcelReader Excel读取器

func NewExcelReader

func NewExcelReader() *ExcelReader

NewExcelReader 构造函数

func (*ExcelReader) AutoRead

func (r *ExcelReader) AutoRead(filename string, values ...any) *ExcelReader

AutoRead 自动读取(默认第一行是表头,从第二行开始,默认Sheet名称为:Sheet1)

func (*ExcelReader) AutoReadBySheetName

func (r *ExcelReader) AutoReadBySheetName(filename, sheetName string, values ...any) *ExcelReader

AutoReadBySheetName 自动读取(默认第一行是表头,从第二行开始)

func (*ExcelReader) GetFinishedRow

func (r *ExcelReader) GetFinishedRow() int

GetFinishedRow 获取读取终止行

func (*ExcelReader) GetOriginalRow

func (r *ExcelReader) GetOriginalRow() int

GetOriginalRow 获取读取起始行

func (*ExcelReader) GetSheetName

func (r *ExcelReader) GetSheetName() string

GetSheetName 获取工作表名称

func (*ExcelReader) GetTitle

func (r *ExcelReader) GetTitle() []string

GetTitle 获取表头

func (*ExcelReader) GetTitleRow

func (r *ExcelReader) GetTitleRow() int

GetTitleRow 获取表头行

func (*ExcelReader) OpenFile

func (r *ExcelReader) OpenFile(filename string, more ...any) *ExcelReader

OpenFile 打开文件

func (*ExcelReader) Read

func (r *ExcelReader) Read() *ExcelReader

Read 读取Excel

func (*ExcelReader) ReadTitle

func (r *ExcelReader) ReadTitle() *ExcelReader

ReadTitle 读取表头

func (*ExcelReader) SetDataByRow

func (r *ExcelReader) SetDataByRow(rowNumber uint64, data []string) *ExcelReader

SetDataByRow 设置单行数据

func (*ExcelReader) SetFinishedRow

func (r *ExcelReader) SetFinishedRow(finishedRow int) *ExcelReader

SetFinishedRow 设置读取终止行

func (*ExcelReader) SetOriginalRow

func (r *ExcelReader) SetOriginalRow(originalRow int) *ExcelReader

SetOriginalRow 设置读取起始行

func (*ExcelReader) SetSheetName

func (r *ExcelReader) SetSheetName(sheetName string) *ExcelReader

SetSheetName 设置工作表名称

func (*ExcelReader) SetTitle

func (r *ExcelReader) SetTitle(titles []string) *ExcelReader

SetTitle 设置表头

func (*ExcelReader) SetTitleRow

func (r *ExcelReader) SetTitleRow(titleRow int) *ExcelReader

SetTitleRow 设置表头行

func (*ExcelReader) ToDataFrame

func (r *ExcelReader) ToDataFrame(titleWithType map[string]series.Type) dataframe.DataFrame

ToDataFrame 获取DataFrame类型数据

func (*ExcelReader) ToDataFrameDefaultType

func (r *ExcelReader) ToDataFrameDefaultType() dataframe.DataFrame

ToDataFrameDefaultType 获取DataFrame类型数据 通过Excel表头自定义数据类型

func (*ExcelReader) ToDataFrameDetectType

func (r *ExcelReader) ToDataFrameDetectType() dataframe.DataFrame

ToDataFrameDetectType 获取DataFrame类型数据 通过自动探寻数据类型

func (*ExcelReader) ToList

func (r *ExcelReader) ToList() map[uint64][]string

ToList 获取数据(数组类型)

func (*ExcelReader) ToMap

func (r *ExcelReader) ToMap(defaultValue string) map[uint64]map[string]string

ToMap 获取数据(map类型)

type ExcelRow

type ExcelRow struct {
	// contains filtered or unexported fields
}

ExcelRow Excel行

func NewExcelRow

func NewExcelRow() *ExcelRow

NewExcelRow 构造函数

func (*ExcelRow) GetCells

func (r *ExcelRow) GetCells() []*ExcelCell

GetCells 获取单元格组

func (*ExcelRow) GetRowNumber

func (r *ExcelRow) GetRowNumber() uint64

GetRowNumber 获取行标

func (*ExcelRow) SetCells

func (r *ExcelRow) SetCells(cells []*ExcelCell) *ExcelRow

SetCells 设置单元格组

func (*ExcelRow) SetRowNumber

func (r *ExcelRow) SetRowNumber(rowNumber uint64) *ExcelRow

SetRowNumber 设置行标

type ExcelWriter

type ExcelWriter struct {
	// contains filtered or unexported fields
}

ExcelWriter Excel写入器

func NewExcelWriter

func NewExcelWriter(filename string, a ...any) *ExcelWriter

NewExcelWriter 初始化

func (*ExcelWriter) ActiveSheetByIndex

func (r *ExcelWriter) ActiveSheetByIndex(sheetIndex int) *ExcelWriter

ActiveSheetByIndex 选择工作表(根据编号)

func (*ExcelWriter) ActiveSheetByName

func (r *ExcelWriter) ActiveSheetByName(sheetName string) *ExcelWriter

ActiveSheetByName 选择工作表(根据名称)

func (*ExcelWriter) AddRow

func (r *ExcelWriter) AddRow(excelRow *ExcelRow) *ExcelWriter

AddRow 增加一行行数据

func (*ExcelWriter) CreateSheet

func (r *ExcelWriter) CreateSheet(sheetName string) *ExcelWriter

CreateSheet 创建工作表

func (*ExcelWriter) GetFilename

func (r *ExcelWriter) GetFilename() string

GetFilename 获取文件名

func (*ExcelWriter) Init

func (r *ExcelWriter) Init(filename string) *ExcelWriter

Init 初始化

func (*ExcelWriter) Save

func (r *ExcelWriter) Save() error

Save 保存文件

func (*ExcelWriter) SetFilename

func (r *ExcelWriter) SetFilename(filename string) *ExcelWriter

SetFilename 设置文件名

func (*ExcelWriter) SetRows

func (r *ExcelWriter) SetRows(excelRows []*ExcelRow) *ExcelWriter

SetRows 设置行数据

func (*ExcelWriter) SetTitleRow

func (r *ExcelWriter) SetTitleRow(titles []string, rowNumber uint64) *ExcelWriter

SetTitleRow 设置标题行

Jump to

Keyboard shortcuts

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