Documentation ¶
Index ¶
- Constants
- func ReadZip(f *zip.ReadCloser) (map[string]string, int, error)
- func ReadZipReader(r *zip.Reader) (map[string]string, int, error)
- type File
- func (f *File) GetCellValue(sheet string, axis string) string
- func (f *File) GetRows(sheet string) ([]XlsxRow, error)
- func (f *File) NewSheet(index int, name string)
- func (f *File) Save() error
- func (f *File) SetActiveSheet(index int)
- func (f *File) SetCellInt(sheet string, axis string, value int)
- func (f *File) SetCellStr(sheet string, axis string, value string)
- func (f *File) SetCellValue(sheet string, axis string, value interface{})
- func (f *File) UpdateLinkedValue()
- func (f *File) WriteTo(name string) error
- type XlsxRow
Constants ¶
const XMLHeader = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
XMLHeader define an XML declaration can also contain a standalone declaration.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
File define a populated xlsx.File struct.
func CreateFile ¶
func CreateFile() *File
CreateFile provide function to create new file by default template. For example: xlsx := CreateFile()
func OpenFile ¶
OpenFile take the name of an XLSX file and returns a populated xlsx.File struct for it.
func (*File) GetCellValue ¶
GetCellValue provide function get value from cell by given sheet index and axis in XLSX file.
func (*File) NewSheet ¶
NewSheet provice function to greate a new sheet by given index, when creating a new XLSX file, the default sheet will be create, when you create a new file, you need to ensure that the index is continuous.
func (*File) SetActiveSheet ¶
SetActiveSheet provide function to set default active sheet of XLSX by given index.
func (*File) SetCellInt ¶
SetCellInt provide function to set int type value of a cell.
func (*File) SetCellStr ¶
SetCellStr provide function to set string type value of a cell.
func (*File) SetCellValue ¶
SetCellValue provide function to set int or string type value of a cell.
func (*File) UpdateLinkedValue ¶
func (f *File) UpdateLinkedValue()
UpdateLinkedValue fix linked values within a spreadsheet are not updating in Office Excel 2007 and 2010. This function will be remove value tag when met a cell have a linked value. Reference https://social.technet.microsoft.com/Forums/office/en-US/e16bae1f-6a2c-4325-8013-e989a3479066/excel-2010-linked-cells-not-updating?forum=excel
Notice: after open XLSX file Excel will be update linked value and generate new value and will prompt save file or not.
For example:
<row r="19" spans="2:2"> <c r="B19"> <f>SUM(Sheet2!D2,Sheet2!D11)</f> <v>100</v> </c> </row>
to
<row r="19" spans="2:2"> <c r="B19"> <f>SUM(Sheet2!D2,Sheet2!D11)</f> </c> </row>
type XlsxRow ¶
type XlsxRow struct { R int `xml:"r,attr"` Spans string `xml:"spans,attr,omitempty"` Hidden bool `xml:"hidden,attr,omitempty"` C []xlsxC `xml:"c"` Ht string `xml:"ht,attr,omitempty"` CustomHeight bool `xml:"customHeight,attr,omitempty"` OutlineLevel uint8 `xml:"outlineLevel,attr,omitempty"` }
XlsxRow directly maps the row element in the namespace http://schemas.openxmlformats.org/spreadsheetml/2006/main - currently I have not checked it for completeness - it does as much as I need.