excelutil

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExcelRegexpNumberType = regexp.MustCompile(`\b(int|tinyint|smallint|mediumint|bigint|float|double|decimal|numeric)\b`)

Functions

func AddSheetByMap

func AddSheetByMap(excel *xlsx.File, sheetName string, mapDatas []map[string]interface{}, headers []string) error

最小工作表名称长度为 1 个字符。 最大工作表名称长度为 31 个字符。 这些特殊字符也不允许: / ?* [ ]

func AddSheetByStruct

func AddSheetByStruct(excel *xlsx.File, sheetName string, records interface{}) error

func AddSheetByTitleMap

func AddSheetByTitleMap(excel *xlsx.File, sheetName string, mapDatas []map[string]interface{}, headers []TtileByKey) error

func AddSheetByTitleMapString

func AddSheetByTitleMapString(excel *xlsx.File, sheetName string, mapDatas []map[string]string, headers []TtileByKey) error

func AddSheetByTitlePointerMap

func AddSheetByTitlePointerMap(excel *xlsx.File, sheetName string, mapDatas []map[string]*string, headers []TtileByKey) error

func BatchInsertListDataByExcelize

func BatchInsertListDataByExcelize(f *excelize.File, SheetName string, rows []map[string]string, titles []map[string]string) (err error)

BatchInsertListDataByExcelize 引用包:github.com/360EntSecGroup-Skylar/excelize 批量插入数据到excel,

func ChangeCellColor

func ChangeCellColor(file *xlsx.File, list *list.List) *xlsx.File

func DataToExcelEntity

func DataToExcelEntity(dataEntity []map[string]string, isMain bool, langCode string) (listobj []sysmodel.ExcelEntity)

func ExportExcelFromMap

func ExportExcelFromMap(sheetName string, headers []string, mapDatas []map[string]interface{}, outPath string) error

map导出excel

func ExportExcelFromMapByTitleMap

func ExportExcelFromMapByTitleMap(sheetName string, headers []TtileByKey, mapDatas []map[string]interface{}, outPath string) error

map导出excel headers {字段名:标题名}

func ExportExcelFromMapStringByTitleMap

func ExportExcelFromMapStringByTitleMap(sheetName string, headers []TtileByKey, mapDatas []map[string]string, outPath string) error

map导出excel headers {字段名:标题名}

func ExportExcelFromPointerMapByTitleMap

func ExportExcelFromPointerMapByTitleMap(sheetName string, headers []TtileByKey, mapDatas []map[string]*string, outPath string) error

map导出excel headers {字段名:标题名}

func ExportExcelFromStruct

func ExportExcelFromStruct(sheetName string, records interface{}, outPath string) error

struct根据tag导出excel

func GetCellString

func GetCellString(cell *xlsx.Cell) (cellString string)

func GetStringValueFromCell

func GetStringValueFromCell(cell *xlsx.Cell) string

func HasTitle

func HasTitle(list []sysmodel.ExcelEntity, obj string, param string) int

func IsNullRow

func IsNullRow(row *xlsx.Row) (result bool)

func RemoveZero

func RemoveZero(value string) string

Types

type TtileByKey

type TtileByKey struct {
	Key         string //字段编码
	Title       string //标题
	IsNumber    bool
	IsRrequired bool
}

Jump to

Keyboard shortcuts

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