excel

package
v0.0.0-...-4aaf4b1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package excel @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2022 central CLI @Author linngc @License

Package excel @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2022 central CLI @Author linngc @License

Package excel @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2022 central CLI @Author linngc @License

Index

Constants

View Source
const (
	ExcelTagKey = "excel"
	Pattern     = "name:(.*?);|index:(.*?);|width:(.*?);|needMerge:(.*?);|replace:(.*?);"
)

定义正则表达式模式

Variables

This section is empty.

Functions

func BuildHeader

func BuildHeader(e *ExcelStyle, sheet, endColName string, headerRowNum int, heads *[]string) (err error)

BuildHeader 构建表头:headerRowNum 当前表头行行号

func BuildTitle

func BuildTitle(e *ExcelStyle, sheet, title, endColName string) (dataRow int)

BuildTitle 构建标题

func BuildTitleHeader

func BuildTitleHeader(e *ExcelStyle, sheet, title, endColName string, heads *[]string) (dataRow int, err error)

BuildTitleHeader 构建标题和表头:headerRowNum 当前表头行行号

func GetExcelColumnName

func GetExcelColumnName(columnNumber int) string

GetExcelColumnName 根据列数生成 Excel 列名

func IsContain

func IsContain(items interface{}, item interface{}) bool

IsContain 判断数组中是否包含指定元素

Types

type ExcelStyle

type ExcelStyle struct {
	F             *excelize.File // excel 对象
	TitleStyle    int            // 表头样式
	HeadStyle     int            // 表头样式
	ContentStyle1 int            // 主体样式1,无背景色
	ContentStyle2 int            // 主体样式2,有背景色
}

ExcelStyle 样式处理

func BuildCustomHeader

func BuildCustomHeader(heads interface{}, sheet, title string) (*ExcelStyle, []string, string, int, error)

BuildCustomHeader 构建自定义复杂表头

func InitializeExcelFile

func InitializeExcelFile() (e *ExcelStyle)

InitializeExcelFile 初始化

func (*ExcelStyle) GetDataRowStyle

func (e *ExcelStyle) GetDataRowStyle()

GetDataRowStyle 数据行样式

func (*ExcelStyle) GetHeadRowStyle

func (e *ExcelStyle) GetHeadRowStyle()

GetHeadRowStyle 列头行样式

func (*ExcelStyle) GetTitleRowStyle

func (e *ExcelStyle) GetTitleRowStyle()

GetTitleRowStyle 标题样式

type ExcelTag

type ExcelTag struct {
	Value     interface{}
	Name      string // 表头标题
	Index     int    // 列下标(从0开始)
	Width     int    // 列宽
	NeedMerge bool   // 是否需要合并
	Replace   string // 替换(需要替换的内容_替换后的内容。比如:1_未开始 ==> 表示1替换为未开始)
}

ExcelTag 指定标签

func NewExcelTag

func NewExcelTag() ExcelTag

NewExcelTag 构造函数,返回一个带有默认值的 ExcelTag 实例

func (*ExcelTag) GetTag

func (e *ExcelTag) GetTag(tag string) (err error)

GetTag 读取字段tag值

Jump to

Keyboard shortcuts

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