xls

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//无线型
	NONE = iota
	//细实线
	LightLine
	//粗实线
	HeavyLine
	//虚线
	ImaginaryLine
	//点线
	DottedLine
)

Border line

View Source
const (
	//黑色
	Black = "000000"
	//红色
	Red = "FF0000"
	//绿色
	Green = "00FF00"
	//蓝色
	Blue = "0000FF"
	//浅蓝色
	LightBlue = "BDD7EE"
	//浅黄色
	LightYellow = "FFF68F"
	//浅灰色
	LightGray = "E8E8E8"
	//西红柿色
	Tomato = "EE5C42"
)

Color 采用RGB格式

View Source
const (
	NoneFill = iota
	PureFill
)

填充, 纯色或不填充

Variables

This section is empty.

Functions

func GetIncAxis

func GetIncAxis(start string, step int, coldir ...bool) string

GetIncAxis 根据start坐标,获取增加step后的坐标, 默认返回的是增加step行,将coldir选中为true,则是返回增加step列

func IsExisted

func IsExisted(arr []string, elmt string) bool

IsExisted 判断elmt是否在arr中,若在,则返回true,不在,返回false

func SplitAxis

func SplitAxis(axis string) (string, int)

SplitAxis 分割行列

Types

type MapRowData

type MapRowData struct {
	RowData  []interface{}
	FirstLoc string
}

MapRowData ---

type SheetRead

type SheetRead struct {
	Name   string
	Data   []interface{}
	Style  []int
	Mother *Workbook
}

SheetRead 读取数据工作页

type SheetStyle

type SheetStyle struct {
	Name string
	Each []*StyleFmt
	*excelize.File
	*sync.WaitGroup
}

SheetStyle ....

func (*SheetStyle) Apply

func (my *SheetStyle) Apply()

Apply 设置表的一些样式

func (*SheetStyle) AssignStyle

func (my *SheetStyle) AssignStyle(axis *[][2]string, merge bool, p interface{})

AssignStyle 分配样式

func (*SheetStyle) SetCellDim

func (my *SheetStyle) SetCellDim(st, ed string, w, h float64) error

SetCellDim ...

type SheetWrite

type SheetWrite struct {
	Name          string
	GlobalData    map[string]interface{} //全局的一些配置信息
	Data          []*MapRowData          //需要写入的数据块
	Mother        *Workbook
	*sync.RWMutex //并发控制

}

SheetWrite 写数据工作页

func (*SheetWrite) AddNewRow

func (my *SheetWrite) AddNewRow(row int)

AddNewRow 增加一个与前行格式一样的复制行

func (*SheetWrite) Flush

func (my *SheetWrite) Flush() (err error)

Flush data to excel

func (*SheetWrite) GetAxisForStyle

func (my *SheetWrite) GetAxisForStyle(src [][2]string, target string, step int, col ...bool) [][2]string

GetAxisForStyle 设置统一的坐标

type StyleFmt

type StyleFmt struct {
	Axis    [][2]string
	Merge   bool
	StyleID int
}

StyleFmt format for sheetcell

type Workbook

type Workbook struct {
	*excelize.File          //文件,考虑到要使用原来的一些方法
	SheetNames     []string //工作簿的所有sheet名字集
	Path           string   //工作簿的路径
	*sync.WaitGroup
	*sync.RWMutex
}

Workbook 工作簿信息

func Init

func Init(path ...string) (*Workbook, error)

Init 初始化

func (*Workbook) NewMulWriteBuffer

func (my *Workbook) NewMulWriteBuffer() []*SheetWrite

NewMulWriteBuffer 新建(整个工作簿)多张写表的buffers tip:可以将sheet名设置为索引常量,例如const Sheet1 = 0,这样也可以清楚知道自己在操作哪张表

func (*Workbook) NewOneWriteBuffer

func (my *Workbook) NewOneWriteBuffer(sheetName ...string) *SheetWrite

NewOneWriteBuffer 新建一个写表的buffer 若是提供sheet名,则返回该sheetbuffer 若没有或提供表名错误,则返回workbook的第一张表buffer

func (*Workbook) OpenStyleSetting

func (my *Workbook) OpenStyleSetting(name string) *SheetStyle

OpenStyleSetting ..打开一个样式设置起

func (*Workbook) ToSave

func (my *Workbook) ToSave(name ...string)

ToSave 保存,若没有输入参数,则保存为workbook.xlsx,若有多个参数,则用最后一个

Jump to

Keyboard shortcuts

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