excel

package
v2.16.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: Apache-2.0 Imports: 11 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 列文字转索引

func ReadDemo added in v2.2.1

func ReadDemo(filename string)

func WriteDemo added in v2.2.1

func WriteDemo(filename string)

Types

type Cell added in v2.2.0

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

Cell Excel单元格

func NewCellAny added in v2.2.1

func NewCellAny(content any) *Cell

NewCellAny 实例化:任意值

func NewCellBool added in v2.2.1

func NewCellBool(content any) *Cell

NewCellBool 实例化:布尔

func NewCellFloat64 added in v2.2.1

func NewCellFloat64(content any) *Cell

NewCellFloat64 实例化:浮点

func NewCellFormula added in v2.2.1

func NewCellFormula(content string) *Cell

NewCellFormula 实例化:公式

func NewCellInt added in v2.2.1

func NewCellInt(content any) *Cell

NewCellInt 实例化:整数

func NewCellTime added in v2.2.1

func NewCellTime(content time.Time) *Cell

NewCellTime 实例化:时间

func (*Cell) GetBorder added in v2.2.1

func (r *Cell) GetBorder() *array.AnyArray[border]

GetBorder 获取边框

func (*Cell) GetContent added in v2.2.0

func (r *Cell) GetContent() any

GetContent 获取内容

func (*Cell) GetContentType added in v2.2.0

func (r *Cell) GetContentType() CellContentType

GetContentType 获取单元格类型

func (*Cell) GetCoordinate added in v2.2.0

func (r *Cell) GetCoordinate() string

GetCoordinate 获取单元格坐标

func (*Cell) GetFontBold added in v2.2.0

func (r *Cell) GetFontBold() bool

GetFontBold 获取字体粗体

func (*Cell) GetFontFamily added in v2.2.0

func (r *Cell) GetFontFamily() string

GetFontFamily 获取字体

func (*Cell) GetFontItalic added in v2.2.0

func (r *Cell) GetFontItalic() bool

GetFontItalic 获取字体斜体

func (*Cell) GetFontRgb added in v2.2.1

func (r *Cell) GetFontRgb() string

GetFontRgb 获取字体颜色

func (*Cell) GetFontSize added in v2.2.0

func (r *Cell) GetFontSize() float64

GetFontSize 获取字体字号

func (*Cell) GetPatternRgb added in v2.2.1

func (r *Cell) GetPatternRgb() string

GetPatternRgb 获取填充色

func (*Cell) GetWrapText added in v2.9.0

func (r *Cell) GetWrapText() bool

GetWrapText 获取自动换行

func (*Cell) Init added in v2.2.0

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

Init 初始化

func (*Cell) SetBorderBottomRbgFunc added in v2.2.1

func (r *Cell) SetBorderBottomRbgFunc(condition func() (string, bool)) *Cell

SetBorderBottomRbgFunc 设置边框颜色:下 函数

func (*Cell) SetBorderBottomRgb added in v2.2.1

func (r *Cell) SetBorderBottomRgb(borderBottomRgb string, condition bool) *Cell

SetBorderBottomRgb 设置边框颜色:下

func (*Cell) SetBorderBottomStyle added in v2.2.1

func (r *Cell) SetBorderBottomStyle(borderBottomStyle int, condition bool) *Cell

SetBorderBottomStyle 设置边框样式:下

func (*Cell) SetBorderBottomStyleFunc added in v2.2.1

func (r *Cell) SetBorderBottomStyleFunc(condition func() (int, bool)) *Cell

SetBorderBottomStyleFunc 设置边框样式:下 函数

func (*Cell) SetBorderDiagonalDownRbgFunc added in v2.2.1

func (r *Cell) SetBorderDiagonalDownRbgFunc(condition func() (string, bool)) *Cell

SetBorderDiagonalDownRbgFunc 设置边框颜色:对角线下 函数

func (*Cell) SetBorderDiagonalDownRgb added in v2.2.1

func (r *Cell) SetBorderDiagonalDownRgb(borderDiagonalDownRgb string, condition bool) *Cell

SetBorderDiagonalDownRgb 设置边框颜色:对角线下

func (*Cell) SetBorderDiagonalDownStyle added in v2.2.1

func (r *Cell) SetBorderDiagonalDownStyle(borderDiagonalDownStyle int, condition bool) *Cell

SetBorderDiagonalDownStyle 设置边框样式:对角线下

func (*Cell) SetBorderDiagonalDownStyleFunc added in v2.2.1

func (r *Cell) SetBorderDiagonalDownStyleFunc(condition func() (int, bool)) *Cell

SetBorderDiagonalDownStyleFunc 设置边框样式:对角线下 函数

func (*Cell) SetBorderDiagonalUpRbgFunc added in v2.2.1

func (r *Cell) SetBorderDiagonalUpRbgFunc(condition func() (string, bool)) *Cell

SetBorderDiagonalUpRbgFunc 设置边框颜色:对角线上 函数

func (*Cell) SetBorderDiagonalUpRgb added in v2.2.1

func (r *Cell) SetBorderDiagonalUpRgb(borderDiagonalUpRgb string, condition bool) *Cell

SetBorderDiagonalUpRgb 设置边框颜色:对角线上

func (*Cell) SetBorderDiagonalUpStyle added in v2.2.1

func (r *Cell) SetBorderDiagonalUpStyle(borderDiagonalUpStyle int, condition bool) *Cell

SetBorderDiagonalUpStyle 设置边框样式:对角线上

func (*Cell) SetBorderDiagonalUpStyleFunc added in v2.2.1

func (r *Cell) SetBorderDiagonalUpStyleFunc(condition func() (int, bool)) *Cell

SetBorderDiagonalUpStyleFunc 设置边框样式:对角线上 函数

func (*Cell) SetBorderLeftRbgFunc added in v2.2.1

func (r *Cell) SetBorderLeftRbgFunc(condition func() (string, bool)) *Cell

SetBorderLeftRbgFunc 设置边框颜色:左 函数

func (*Cell) SetBorderLeftRgb added in v2.2.1

func (r *Cell) SetBorderLeftRgb(borderLeftRgb string, condition bool) *Cell

SetBorderLeftRgb 设置边框颜色:左

func (*Cell) SetBorderLeftStyle added in v2.2.1

func (r *Cell) SetBorderLeftStyle(borderLeftStyle int, condition bool) *Cell

SetBorderLeftStyle 设置边框样式:左

func (*Cell) SetBorderLeftStyleFunc added in v2.2.1

func (r *Cell) SetBorderLeftStyleFunc(condition func() (int, bool)) *Cell

SetBorderLeftStyleFunc 设置边框样式:左 函数

func (*Cell) SetBorderRightRbgFunc added in v2.2.1

func (r *Cell) SetBorderRightRbgFunc(condition func() (string, bool)) *Cell

SetBorderRightRbgFunc 设置边框颜色:右 函数

func (*Cell) SetBorderRightRgb added in v2.2.1

func (r *Cell) SetBorderRightRgb(borderRightRgb string, condition bool) *Cell

SetBorderRightRgb 设置边框颜色:右

func (*Cell) SetBorderRightStyle added in v2.2.1

func (r *Cell) SetBorderRightStyle(borderRightStyle int, condition bool) *Cell

SetBorderRightStyle 设置边框样式:右

func (*Cell) SetBorderRightStyleFunc added in v2.2.1

func (r *Cell) SetBorderRightStyleFunc(condition func() (int, bool)) *Cell

SetBorderRightStyleFunc 设置边框样式:右 函数

func (*Cell) SetBorderSurrounding added in v2.2.1

func (r *Cell) SetBorderSurrounding(borderRgb string, borderStyle int, condition bool) *Cell

SetBorderSurrounding 设置四周边框

func (*Cell) SetBorderSurroundingFunc added in v2.2.1

func (r *Cell) SetBorderSurroundingFunc(condition func() (string, int, bool)) *Cell

SetBorderSurroundingFunc 设置四周边框 函数

func (*Cell) SetBorderTopRbgFunc added in v2.2.1

func (r *Cell) SetBorderTopRbgFunc(condition func() (string, bool)) *Cell

SetBorderTopRbgFunc 设置边框颜色:上 函数

func (*Cell) SetBorderTopRgb added in v2.2.1

func (r *Cell) SetBorderTopRgb(borderTopRgb string, condition bool) *Cell

SetBorderTopRgb 设置边框颜色:上

func (*Cell) SetBorderTopStyle added in v2.2.1

func (r *Cell) SetBorderTopStyle(borderTopStyle int, condition bool) *Cell

SetBorderTopStyle 设置边框样式:上

func (*Cell) SetBorderTopStyleFunc added in v2.2.1

func (r *Cell) SetBorderTopStyleFunc(condition func() (int, bool)) *Cell

SetBorderTopStyleFunc 设置边框样式:上 函数

func (*Cell) SetContent added in v2.2.0

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

SetContent 设置内容

func (*Cell) SetContentType added in v2.2.0

func (r *Cell) SetContentType(contentType CellContentType) *Cell

SetContentType 设置单元格类型

func (*Cell) SetCoordinate added in v2.2.0

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

SetCoordinate 设置单元格坐标

func (*Cell) SetFontBold added in v2.2.0

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

SetFontBold 设置字体粗体

func (*Cell) SetFontBoldFunc added in v2.2.1

func (r *Cell) SetFontBoldFunc(condition func() (bool, bool)) *Cell

SetFontBoldFunc 设置字体粗体:函数

func (*Cell) SetFontFamily added in v2.2.0

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

SetFontFamily 设置字体

func (*Cell) SetFontFamilyFunc added in v2.2.1

func (r *Cell) SetFontFamilyFunc(condition func() (string, bool)) *Cell

SetFontFamilyFunc 设置字体:函数

func (*Cell) SetFontItalic added in v2.2.0

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

SetFontItalic 设置字体斜体

func (*Cell) SetFontItalicFunc added in v2.2.1

func (r *Cell) SetFontItalicFunc(condition func() (bool, bool)) *Cell

SetFontItalicFunc 设置字体斜体:函数

func (*Cell) SetFontRgb added in v2.2.1

func (r *Cell) SetFontRgb(fontRgb string, condition bool) *Cell

SetFontRgb 设置字体颜色

func (*Cell) SetFontRgbFunc added in v2.2.1

func (r *Cell) SetFontRgbFunc(condition func() (string, bool)) *Cell

SetFontRgbFunc 设置字体颜色:函数

func (*Cell) SetFontSize added in v2.2.0

func (r *Cell) SetFontSize(fontSize float64, condition bool) *Cell

SetFontSize 设置字体字号

func (*Cell) SetFontSizeFunc added in v2.2.1

func (r *Cell) SetFontSizeFunc(condition func() (float64, bool)) *Cell

SetFontSizeFunc 设置字体字号:函数

func (*Cell) SetPatternRgb added in v2.2.1

func (r *Cell) SetPatternRgb(patternRgb string, condition bool) *Cell

SetPatternRgb 设置填充色

func (*Cell) SetPatternRgbFunc added in v2.2.1

func (r *Cell) SetPatternRgbFunc(condition func() (string, bool)) *Cell

SetPatternRgbFunc 设置填充色:函数

func (*Cell) SetWrapText added in v2.9.0

func (r *Cell) SetWrapText(wrapText bool) *Cell

SetWrapText 设置自动换行

type CellContentType added in v2.2.0

type CellContentType string

CellContentType 单元格内容类型

const (
	CellContentTypeAny     CellContentType = "any"
	CellContentTypeFormula CellContentType = "formula"
	CellContentTypeInt     CellContentType = "int"
	CellContentTypeFloat64 CellContentType = "float64"
	CellContentTypeBool    CellContentType = "bool"
	CellContentTypeTime    CellContentType = "time"
)

type Reader added in v2.2.0

type Reader struct {
	Err error
	// contains filtered or unexported fields
}

Reader Excel读取器

func NewReader added in v2.2.1

func NewReader() *Reader

NewReader 构造函数

func (*Reader) AutoRead added in v2.2.0

func (r *Reader) AutoRead(filename ...any) *Reader

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

func (*Reader) AutoReadBySheetName added in v2.2.0

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

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

func (*Reader) Data added in v2.2.1

Data 获取数据:有序字典

func (*Reader) DataWithTitle added in v2.2.1

func (r *Reader) DataWithTitle() (*dict.AnyOrderlyDict[uint64, *dict.AnyDict[string, string]], error)

DataWithTitle 获取数据:带有title的有序字典

func (*Reader) GetFinishedRow added in v2.2.0

func (r *Reader) GetFinishedRow() int

GetFinishedRow 获取读取终止行

func (*Reader) GetOriginalRow added in v2.2.0

func (r *Reader) GetOriginalRow() int

GetOriginalRow 获取读取起始行

func (*Reader) GetSheetName added in v2.2.0

func (r *Reader) GetSheetName() string

GetSheetName 获取工作表名称

func (*Reader) GetTitle added in v2.2.0

func (r *Reader) GetTitle() *array.AnyArray[string]

GetTitle 获取表头

func (*Reader) GetTitleRow added in v2.2.0

func (r *Reader) GetTitleRow() int

GetTitleRow 获取表头行

func (*Reader) OpenFile added in v2.2.0

func (r *Reader) OpenFile(filename ...any) *Reader

OpenFile 打开文件

func (*Reader) Read added in v2.2.0

func (r *Reader) Read() *Reader

Read 读取Excel

func (*Reader) ReadTitle added in v2.2.0

func (r *Reader) ReadTitle() *Reader

ReadTitle 读取表头

func (*Reader) SetDataByRow added in v2.2.0

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

SetDataByRow 设置单行数据

func (*Reader) SetFinishedRow added in v2.2.0

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

SetFinishedRow 设置读取终止行

func (*Reader) SetOriginalRow added in v2.2.0

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

SetOriginalRow 设置读取起始行

func (*Reader) SetSheetName added in v2.2.0

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

SetSheetName 设置工作表名称

func (*Reader) SetTitle added in v2.2.0

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

SetTitle 设置表头

func (*Reader) SetTitleRow added in v2.2.0

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

SetTitleRow 设置表头行

func (*Reader) ToDataFrame added in v2.2.0

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

ToDataFrame 获取DataFrame类型数据

func (*Reader) ToDataFrameDefaultType added in v2.2.0

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

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

func (*Reader) ToDataFrameDetectType added in v2.2.0

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

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

type Row added in v2.2.0

type Row struct {
	Err error
	// contains filtered or unexported fields
}

Row Excel行

func NewRow added in v2.2.1

func NewRow() *Row

NewRow 构造函数

func (*Row) GetCells added in v2.2.0

func (r *Row) GetCells() *array.AnyArray[*Cell]

GetCells 获取单元格组

func (*Row) GetRowNumber added in v2.2.0

func (r *Row) GetRowNumber() uint64

GetRowNumber 获取行标

func (*Row) SetCells added in v2.2.0

func (r *Row) SetCells(cells []*Cell) *Row

SetCells 设置单元格组

func (*Row) SetRowNumber added in v2.2.0

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

SetRowNumber 设置行标

type Writer added in v2.2.0

type Writer struct {
	Err error
	// contains filtered or unexported fields
}

Writer Excel写入器

func NewWriter added in v2.2.1

func NewWriter(filename ...any) *Writer

NewWriter 初始化

func (*Writer) ActiveSheetByIndex added in v2.2.0

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

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

func (*Writer) ActiveSheetByName added in v2.2.0

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

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

func (*Writer) AddRow added in v2.2.0

func (r *Writer) AddRow(excelRow *Row) *Writer

AddRow 增加一行行数据

func (*Writer) CreateSheet added in v2.2.0

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

CreateSheet 创建工作表

func (*Writer) Download added in v2.2.7

func (r *Writer) Download(writer http.ResponseWriter) error

Download 下载Excel

func (*Writer) GetExcelizeFile added in v2.2.8

func (r *Writer) GetExcelizeFile() *excelize.File

GetExcelizeFile 获取excelize文件对象

func (*Writer) GetFilename added in v2.2.0

func (r *Writer) GetFilename() string

GetFilename 获取文件名

func (*Writer) Save added in v2.2.0

func (r *Writer) Save() error

Save 保存文件

func (*Writer) SetColumnWidthByIndex added in v2.3.0

func (r *Writer) SetColumnWidthByIndex(col int, width float64) *Writer

SetColumnWidthByIndex 设置单列宽:通过列索引

func (*Writer) SetColumnWidthByText added in v2.3.0

func (r *Writer) SetColumnWidthByText(col string, width float64) *Writer

SetColumnWidthByText 设置单列宽:通过列名称

func (*Writer) SetColumnsWidthByIndex added in v2.3.0

func (r *Writer) SetColumnsWidthByIndex(startCol, endCol int, width float64) *Writer

SetColumnsWidthByText 设置多列宽:通过列索引

func (*Writer) SetColumnsWidthByText added in v2.3.0

func (r *Writer) SetColumnsWidthByText(startCol, endCol string, width float64) *Writer

SetColumnsWidthByText 设置多列宽:通过列名称

func (*Writer) SetFilename added in v2.2.0

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

SetFilename 设置文件名

func (*Writer) SetRows added in v2.2.0

func (r *Writer) SetRows(excelRows []*Row) *Writer

SetRows 设置行数据

func (*Writer) SetSheetName added in v2.4.0

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

SetSheetName 设置sheet名称

func (*Writer) SetTitleRow added in v2.2.0

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

SetTitleRow 设置标题行

Jump to

Keyboard shortcuts

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