Documentation ¶
Index ¶
- Constants
- Variables
- func FileToSlice(path string) ([][][]string, error)
- func HSLToRGB(h, s, l float64) (r, g, b uint8)
- func MakeDefaultContentTypes() (types xlsxTypes)
- func RGBToHSL(r, g, b uint8) (h, s, l float64)
- func TimeFromExcelTime(excelTime float64, date1904 bool) time.Time
- type Alignment
- type Border
- type Cell
- func (c *Cell) Bool() bool
- func (c *Cell) Float() (float64, error)
- func (c *Cell) FormattedValue() string
- func (c *Cell) Formula() string
- func (c *Cell) GetNumberFormat() string
- func (c *Cell) GetStyle() *Style
- func (c *Cell) Int() (int, error)
- func (c *Cell) Int64() (int64, error)
- func (c *Cell) SetBool(b bool)
- func (c *Cell) SetFloat(n float64)
- func (c *Cell) SetFloatWithFormat(n float64, format string)
- func (c *Cell) SetFormula(formula string)
- func (c *Cell) SetInt(n int)
- func (c *Cell) SetInt64(n int64)
- func (c *Cell) SetString(s string)
- func (c *Cell) SetStyle(style *Style)
- func (c *Cell) String() string
- func (c *Cell) Type() CellType
- type CellInterface
- type CellType
- type Col
- type File
- type Fill
- type Font
- type HSL
- type Pane
- type RefTable
- type Row
- type Sheet
- type SheetView
- type Style
- type WorkBookRels
- type XLSXReaderError
Constants ¶
const ColWidth = 9.5
Default column width in excel
const MJD_0 float64 = 2400000.5
const MJD_JD2000 float64 = 51544.5
const TEMPLATE_DOCPROPS_APP = `` /* 308-byte string literal not displayed */
const TEMPLATE_DOCPROPS_CORE = `` /* 364-byte string literal not displayed */
const TEMPLATE_XL_THEME_THEME = `` /* 10942-byte string literal not displayed */
const TEMPLATE__RELS_DOT_RELS = `` /* 580-byte string literal not displayed */
Variables ¶
var HSLModel = color.ModelFunc(hslModel)
HSLModel converts any color.Color to a HSL color.
Functions ¶
func FileToSlice ¶
A convenient wrapper around File.ToSlice, FileToSlice will return the raw data contained in an Excel XLSX file as three dimensional slice. The first index represents the sheet number, the second the row number, and the third the cell number.
For example:
var mySlice [][][]string var value string mySlice = xlsx.FileToSlice("myXLSX.xlsx") value = mySlice[0][0][0]
Here, value would be set to the raw value of the cell A1 in the first sheet in the XLSX file.
func MakeDefaultContentTypes ¶
func MakeDefaultContentTypes() (types xlsxTypes)
Types ¶
type Border ¶
Border is a high level structure intended to provide user access to the contents of Border Style within an Sheet.
func DefaulBorder ¶
func DefaulBorder() *Border
type Cell ¶
Cell is a high level structure intended to provide user access to the contents of Cell within an xlsx.Row.
func (*Cell) Bool ¶
Bool returns a boolean from a cell's value. TODO: Determine if the current return value is appropriate for types other than CellTypeBool.
func (*Cell) FormattedValue ¶
FormattedValue returns the formatted version of the value. If it's a string type, c.Value will just be returned. Otherwise, it will attempt to apply Excel formatting to the value.
func (*Cell) GetNumberFormat ¶
GetNumberFormat returns the number format string for a cell.
func (*Cell) Int ¶
Int returns the value of cell as integer. Has max 53 bits of precision See: float64(int64(math.MaxInt))
func (*Cell) SetFloatWithFormat ¶
SetFloatWithFormat sets the value of a cell to a float and applies formatting to the cell.
func (*Cell) SetFormula ¶
SetFormula sets the format string for a cell.
type CellInterface ¶
CellInterface defines the public API of the Cell.
type CellType ¶
type CellType int
CellType is an int type for storing metadata about the data type in the cell.
type File ¶
type File struct { Date1904 bool Sheets []*Sheet Sheet map[string]*Sheet // contains filtered or unexported fields }
File is a high level structure providing a slice of Sheet structs to the user.
func OpenFile ¶
OpenFile() take the name of an XLSX file and returns a populated xlsx.File struct for it.
func ReadZip ¶
func ReadZip(f *zip.ReadCloser) (*File, error)
ReadZip() takes a pointer to a zip.ReadCloser and returns a xlsx.File struct populated with its contents. In most cases ReadZip is not used directly, but is called internally by OpenFile.
func ReadZipReader ¶
ReadZipReader() can be used to read an XLSX in memory without touching the filesystem.
func (*File) MarshallParts ¶
Construct a map of file name to XML content representing the file in terms of the structure of an XLSX file.
func (*File) ToSlice ¶
Return the raw data contained in the File as three dimensional slice. The first index represents the sheet number, the second the row number, and the third the cell number.
For example:
var mySlice [][][]string var value string mySlice = xlsx.FileToSlice("myXLSX.xlsx") value = mySlice[0][0][0]
Here, value would be set to the raw value of the cell A1 in the first sheet in the XLSX file.
type Fill ¶
Fill is a high level structure intended to provide user access to the contents of background and foreground color index within an Sheet.
func DefaulFill ¶
func DefaulFill() *Fill
type Font ¶
type Font struct { Size int Name string Family int Charset int Color string Bold bool Italic bool Underline bool }
func DefaulFont ¶
func DefaulFont() *Font
type HSL ¶
type HSL struct {
H, S, L float64
}
HSL represents a cylindrical coordinate of points in an RGB color model.
Values are in the range 0 to 1.
type RefTable ¶
type RefTable struct {
// contains filtered or unexported fields
}
func MakeSharedStringRefTable ¶
func MakeSharedStringRefTable(source *xlsxSST) *RefTable
MakeSharedStringRefTable() takes an xlsxSST struct and converts it's contents to an slice of strings used to refer to string values by numeric index - this is the model used within XLSX worksheet (a numeric reference is stored to a shared cell value).
func NewSharedStringRefTable ¶
func NewSharedStringRefTable() *RefTable
NewSharedStringRefTable() creates a new, empty RefTable.
func (*RefTable) AddString ¶
AddString adds a string to the reference table and return it's numeric index. If the string already exists then it simply returns the existing index.
func (*RefTable) ResolveSharedString ¶
Resolvesharedstring() looks up a string value by numeric index from a provided reference table (just a slice of strings in the correct order). This function only exists to provide clarity or purpose via it's name.
type Row ¶
func (*Row) WriteSlice ¶
Writes an array to row r. Accepts a pointer to array type 'e', and writes the number of columns to write, 'cols'. If 'cols' is < 0, the entire array will be written if possible. Retuens -1 if the 'e' doesn't point to an array, otherwise the number of columns written.
func (*Row) WriteStruct ¶
Writes a struct to row r. Accepts a pointer to struct type 'e', and the number of columns to write, `cols`. If 'cols' is < 0, the entire struct will be written if possible. Returns -1 if the 'e' doesn't point to a struct, otherwise the number of columns written
type Sheet ¶
type Sheet struct { Name string File *File Rows []*Row Cols []*Col MaxRow int MaxCol int Hidden bool SheetViews []SheetView }
Sheet is a high level structure intended to provide user access to the contents of a particular sheet within an XLSX file.
type Style ¶
type Style struct { Border Border Fill Fill Font Font ApplyBorder bool ApplyFill bool ApplyFont bool Alignment Alignment }
Style is a high level structure intended to provide user access to the contents of Style within an XLSX file.
type WorkBookRels ¶
func (*WorkBookRels) MakeXLSXWorkbookRels ¶
func (w *WorkBookRels) MakeXLSXWorkbookRels() xlsxWorkbookRels
type XLSXReaderError ¶
type XLSXReaderError struct {
Err string
}
XLSXReaderError is the standard error type for otherwise undefined errors in the XSLX reading process.
func (*XLSXReaderError) Error ¶
func (e *XLSXReaderError) Error() string
String() returns a string value from an XLSXReaderError struct in order that it might comply with the os.Error interface.