wxlsx

package
v0.0.0-...-670bf6b Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2017 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToExcel

func ArrayToExcel(sheetName string, data [][]string) (*xlsx.File, error)

ArrayToExcel write data

func ExportCSV

func ExportCSV(excelFileName string, sheetIndex int, delimiter string, out io.Writer) error

ExportCSV export

func GetCellValue

func GetCellValue(location, sheetName, cell, errDefault string) string

GetCellValue return file sheet cell value cell is Excel format. eg: AA23

func GetCellsValues

func GetCellsValues(location, sheetName string, cells []string, errDefault string) (values []string)

GetCellsValues returns cells values

func GetLetterIndex

func GetLetterIndex(letter string) (r int)

GetLetterIndex returns Excel Cell ColumnIndex index start from 0

func GetMapKeys

func GetMapKeys(m map[string]interface{}) (keys []string)

GetMapKeys return map keys

func GetRowColIndex

func GetRowColIndex(cell string) (row, col int)

GetRowColIndex returns Cell row and column index. the index start from 0

func GetRowColValue

func GetRowColValue(location, sheetName string, row, col int, errDefault string) string

GetRowColValue returns excel row col value parameters: location sheetname, row,col

func GetSheetCellValue

func GetSheetCellValue(sheet *Sheet, cell, errDefault string) string

GetSheetCellValue returns sheet cell value

func GetSheetCellsValues

func GetSheetCellsValues(sheet *Sheet, cells []string, errDefault string) (values []string)

GetSheetCellsValues return cells values.

func GetSheetColumnNames

func GetSheetColumnNames(file string, sheetName string) ([]string, error)

GetSheetColumnNames returns Sheet column names, call sheet GetHeaderRowValues

func GetSheetNameByIndex

func GetSheetNameByIndex(file string, index int) (string, error)

GetSheetNameByIndex returns index sheet name.

func GetSheetNames

func GetSheetNames(location string) ([]string, error)

GetSheetNames returns include sheet names.

func GetSheetRowColValue

func GetSheetRowColValue(sheet *Sheet, row, col int, errDefault string) string

GetSheetRowColValue returns sheet row col value

func ImportCSV

func ImportCSV(csvPath string, delimiter string) (*xlsx.File, error)

ImportCSV func

func IsHasSheet

func IsHasSheet(file, sheetName string) bool

IsHasSheet check sheet exists.

func JSONToExcel

func JSONToExcel(
	sheetName string,
	jsData []byte,
	include string,
	exclude string,
	locale string,
) (*xlsx.File, error)

JSONToExcel define values jsData should contain a array

func OpenBook

func OpenBook(location string) (*xlsx.File, error)

OpenBook returns Workbook

func PrintSheet

func PrintSheet(sheet *Sheet)

PrintSheet utils

func PrintSheetByIndex

func PrintSheetByIndex(file string, sheetIndex int)

PrintSheetByIndex print

func PrintSheetByName

func PrintSheetByName(file string, sheetName string)

PrintSheetByName print

func PrintSheetNames

func PrintSheetNames(file string)

PrintSheetNames print

func SqlRowsToExcel

func SqlRowsToExcel(sheetName string,
	rows *sql.Rows,
	include string,
	exclude string) (*xlsx.File, error)

SqlRowsToExcel sql rows to excel disable locale

func SqlRowsToExcelWithLocale

func SqlRowsToExcelWithLocale(sheetName string,
	tableName string,
	rows *sql.Rows,
	include string,
	exclude string,
	locale string,
	enableLocale bool) (*xlsx.File, error)

SqlRowsToExcelWithLocale sql rows to excel Locale message, table column name. params:

sheetName
rows
include
exclude
locale
enableLocale

func ValueToExcel

func ValueToExcel(sheetName string,
	rows interface{},
	include string,
	exclude string) (*xlsx.File, error)

ValueToExcel value to excel

func ValueToExcelWithLocale

func ValueToExcelWithLocale(sheetName string,
	rows interface{},
	include string,
	exclude string,
	locale string,
	enableLocale bool) (*xlsx.File, error)

ValueToExcelWithLocale value to excel with locale rows should be slice type.

Types

type Sheet

type Sheet struct {
	*xlsx.Sheet
}

Sheet define sheet

func GetSheet

func GetSheet(file string, sheetIndex int) (*Sheet, error)

GetSheet same as GetSheetByIndex

func GetSheetByIndex

func GetSheetByIndex(file string, sheetIndex int) (*Sheet, error)

GetSheetByIndex returns Sheet index from 0

func GetSheetByName

func GetSheetByName(file string, sheetName string) (*Sheet, error)

GetSheetByName returns Sheet

func GetSheetFromBookByIndex

func GetSheetFromBookByIndex(book *xlsx.File, sheetIndex int) (*Sheet, error)

GetSheetFromBookByIndex returns Sheet

func GetSheetFromByteArray

func GetSheetFromByteArray(data []byte, sheetIndex int) (*Sheet, error)

GetSheetFromByteArray returns Sheet

func NewSheet

func NewSheet(sheet *xlsx.Sheet) *Sheet

NewSheet create Sheet

func (*Sheet) GetCellFloat64ByRowIndexColName

func (s *Sheet) GetCellFloat64ByRowIndexColName(rowIndex int, colName string) float64

GetCellFloat64ByRowIndexColName return cell float value

func (*Sheet) GetCellIntByRowIndexColName

func (s *Sheet) GetCellIntByRowIndexColName(rowIndex int, colName string) int

GetCellIntByRowIndexColName return cell int value

func (*Sheet) GetCellValue

func (s *Sheet) GetCellValue(cell string) (value string)

GetCellValue returns cell value

func (*Sheet) GetCellValueByRowIndexColName

func (s *Sheet) GetCellValueByRowIndexColName(rowIndex int, colName string) string

GetCellValueByRowIndexColName returns cell value

func (*Sheet) GetColNameIndex

func (s *Sheet) GetColNameIndex(colName string) int

GetColNameIndex returns colname index -1 means not found.

func (*Sheet) GetHeaderRowValues

func (s *Sheet) GetHeaderRowValues() (vs []string)

GetHeaderRowValues return header row values

func (*Sheet) GetRowColValue

func (s *Sheet) GetRowColValue(row, col int, errDefault string) (value string)

GetRowColValue returns row col value process out of index error

func (*Sheet) Print

func (sheet *Sheet) Print()

Print print

func (*Sheet) PrintCell

func (sheet *Sheet) PrintCell(cell string)

PrintCell cell format example: A1

Jump to

Keyboard shortcuts

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