Documentation ¶
Index ¶
- Constants
- Variables
- func GetActiveSheetName(f *excelize.File) string
- func GetCellType(f *excelize.File, sheetName string, col, row int) (excelize.CellType, error)
- func GetCellValue(f *excelize.File, sheetName string, col, row int, opts ...excelize.Options) (string, error)
- func NewFileWithPath(filePath string, opts ...excelize.Options) (*excelize.File, error)
- func OpenFile(filePath string, opts ...excelize.Options) (*excelize.File, error)
- func SetCellBool(f *excelize.File, sheetName string, col, row int, value bool) error
- func SetCellFloat(f *excelize.File, sheetName string, col, row int, value float64, ...) error
- func SetCellInt(f *excelize.File, sheetName string, col, row int, value int) error
- func SetCellStr(f *excelize.File, sheetName string, col, row int, value string) error
- func SetCellUint(f *excelize.File, sheetName string, col, row int, value uint64) error
- func SetCellValue(f *excelize.File, sheetName string, col, row int, value interface{}) error
Constants ¶
View Source
const ( // MaxRows /* PS: (1) 从 1 开始 (2) 范围: [1, 1048576] */ MaxRows = excelize.TotalRows // MaxColumns /* PS: (1) 从 1 开始 (2) 范围: [1, 16384] */ MaxColumns = excelize.MaxColumns )
Variables ¶
View Source
var ( // CellNameToCoordinates 单元格名 => 坐标(行、列) /* e.g. fmt.Println(excelKit.CellNameToCoordinates("A1")) // 1 1 <nil> fmt.Println(excelKit.CellNameToCoordinates("Z3")) // 26 3 <nil> */ CellNameToCoordinates func(cell string) (col int, row int, err error) = excelize.CellNameToCoordinates // CoordinatesToCellName 坐标(行、列) => 单元格名 /* e.g. fmt.Println(excelKit.CoordinatesToCellName(1, 1)) // A1 <nil> fmt.Println(excelKit.CoordinatesToCellName(1, 1, true)) // $A$1 <nil> */ CoordinatesToCellName func(col, row int, abs ...bool) (cellName string, err error) = excelize.CoordinatesToCellName // JoinCellName /* e.g. fmt.Println(excelKit.JoinCellName("C", 3)) // C3 <nil> */ JoinCellName func(col string, row int) (cellName string, err error) = excelize.JoinCellName // SplitCellName /* e.g. fmt.Println(excelKit.SplitCellName("C3")) // C 3 <nil> fmt.Println(excelKit.SplitCellName("c3")) // c 3 <nil> */ SplitCellName func(cell string) (col string, row int, err error) = excelize.SplitCellName )
View Source
var ( // ColumnNumberToName 列数字 => 列名 /* @param num 有效范围: [1, 16384] e.g. fmt.Println(excelKit.ColumnNumberToName(1)) // A <nil> fmt.Println(excelKit.ColumnNumberToName(2)) // B <nil> fmt.Println(excelKit.ColumnNumberToName(10)) // J <nil> fmt.Println(excelKit.ColumnNumberToName(37)) // AK <nil> */ ColumnNumberToName func(num int) (string, error) = excelize.ColumnNumberToName // ColumnNameToNumber 列名 => 列数字 /* e.g. fmt.Println(excelKit.ColumnNameToNumber("A")) // 1 <nil> fmt.Println(excelKit.ColumnNameToNumber("a")) // 1 <nil> fmt.Println(excelKit.ColumnNameToNumber("B")) // 2 <nil> fmt.Println(excelKit.ColumnNameToNumber("AK")) // 37 <nil> */ ColumnNameToNumber func(name string) (int, error) = excelize.ColumnNameToNumber )
View Source
var NewFile func(opts ...excelize.Options) *excelize.File = excelize.NewFile
NewFile 新建一个空白的Excel文件.
PS: (1) 返回的 *excelize.File实例,不再使用时应当调用 File.Close(); (2) 新建的空白的Excel文件,其内只有1个空白的工作表,表名为"Sheet1".
View Source
var OpenReader func(r io.Reader, opts ...excelize.Options) (*excelize.File, error) = excelize.OpenReader
OpenReader 打开数据流.
PS: 可能会返回 excelize.ErrWorkbookFileFormat,原因: 文件格式不支持(比如.xls文件).
@params r 数据流(包括: 远程文件)
Functions ¶
func GetActiveSheetName ¶ added in v3.0.38
func GetActiveSheetName(f *excelize.File) string
func GetCellType ¶ added in v3.0.38
func GetCellValue ¶ added in v3.0.38
func NewFileWithPath ¶
NewFileWithPath 新建一个空白的Excel文件.
PS: (1) 返回的 *excelize.File实例,不再使用时应当调用 File.Close(); (2) 新建的空白的Excel文件,其内只有1个空白的工作表,表名为"Sheet1".
@param path 文件的路径(如果文件已经存在,会覆盖它)
func SetCellBool ¶ added in v3.0.38
func SetCellFloat ¶ added in v3.0.38
func SetCellInt ¶ added in v3.0.38
func SetCellStr ¶ added in v3.0.38
func SetCellUint ¶ added in v3.0.38
func SetCellValue ¶ added in v3.0.38
SetCellValue 设置单元格的值.
@param sheetName 工作表名 @param col [1, 16384] @param row [1, 1048576]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.