README
¶
xls
Pure Golang xls library writen by Rongshu Tech(chinese).
Thanks for contributions from Tamás Gulácsi, sergeilem.
English User please mailto Liu Ming
This is a xls library writen in pure Golang. Almostly it is translated from the libxls library in c.
The master brunch has just the reading function without the format.
new_formater branch is for better format for date and number ,but just under test, you can try it in development environment. If you have some problem about the output format, tell me the problem, I will try to fix it.
Basic Usage
-
Use Open function for open file
-
Use OpenWithCloser function for open file and use the return value closer for close file
-
Use OpenReader function for open xls from a reader, you should close related file in your own code
-
Follow the example in GODOC
Documentation
¶
Overview ¶
xls package use to parse the 97 -2004 microsoft xls file(".xls" suffix, NOT ".xlsx" suffix )
there are some example in godoc, please follow them.
Index ¶
- Constants
- Variables
- func MakeBytes(size int) []byte
- func MakeStrings(size int) []string
- func MakeUint16(size int) []uint16
- type BlankCol
- type CellRange
- type Col
- type Coler
- type Font
- type FontInfo
- type Format
- type FormulaCol
- type HyperLink
- type LabelsstCol
- type MulBlankCol
- type MulrkCol
- type NumberCol
- type RK
- type Ranger
- type RkCol
- type Row
- type SstInfo
- type WorkBook
- type WorkSheet
- type Xf5
- type Xf8
- type XfRk
Examples ¶
Constants ¶
const MJD_0 float64 = 2400000.5
const MJD_JD2000 float64 = 51544.5
Variables ¶
var ErrIsInt = fmt.Errorf("is int")
Functions ¶
func MakeStrings ¶ added in v1.0.1
func MakeUint16 ¶ added in v1.0.1
Types ¶
type FormulaCol ¶
type FormulaCol struct { Header struct { Col IndexXf uint16 Result [8]byte Flags uint16 // contains filtered or unexported fields } Bts []byte }
func (*FormulaCol) String ¶
func (c *FormulaCol) String(wb *WorkBook) []string
type HyperLink ¶
type HyperLink struct { CellRange Description string TextMark string TargetFrame string Url string ShortedFilePath string ExtendedFilePath string IsUrl bool }
hyperlink type's content
type LabelsstCol ¶
func (*LabelsstCol) String ¶
func (c *LabelsstCol) String(wb *WorkBook) []string
type MulBlankCol ¶
func (*MulBlankCol) LastCol ¶
func (c *MulBlankCol) LastCol() uint16
func (*MulBlankCol) String ¶
func (c *MulBlankCol) String(wb *WorkBook) []string
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row the data of one row
func (*Row) Col ¶
Col Get the Nth Col from the Row, if has not, return nil. Suggest use Has function to test it.
type WorkBook ¶
type WorkBook struct { Is5ver bool Type uint16 Codepage uint16 Xfs []st_xf_data Fonts []Font Formats map[uint16]*Format Author string // contains filtered or unexported fields }
xls workbook type
func OpenReader ¶
func OpenReader(reader io.ReadSeeker, charset string) (wb *WorkBook, err error)
Open xls file from reader
func OpenWithCloser ¶ added in v1.0.0
Open one xls file and return the closer
func (*WorkBook) GetSheet ¶
Get one sheet by its number
Example ¶
Output: read the content of first two cols in each row
Output:
func (*WorkBook) Parse ¶
func (w *WorkBook) Parse(buf io.ReadSeeker)
func (*WorkBook) ReadAllCells ¶
helper function to read all cells from file Notice: the max value is the limit of the max capacity of lines. Warning: the helper function will need big memeory if file is large.
type WorkSheet ¶
type WorkSheet struct { Name string //NOTICE: this is the max row number of the sheet, so it should be count -1 MaxRow uint16 // contains filtered or unexported fields }
WorkSheet in one WorkBook