Documentation
¶
Overview ¶
Package xls provides a pure-Go reader and writer for legacy Excel .xls files (BIFF5/BIFF8 format) via OLE2 compound document parsing.
Index ¶
- type File
- func (x *File) AddPicture(_, _, _ string, _ *xmltypes.GraphicOptions) error
- func (x *File) AutoFilter(_, _, _ string) error
- func (x *File) Close() error
- func (x *File) DeleteSheet(name string) error
- func (x *File) DuplicateSheet(from, _ int) error
- func (x *File) FreezePane(_, _ string, _, _ int) error
- func (x *File) GetCellFormula(_, _ string) (string, error)
- func (x *File) GetCellValue(sheet, axis string) (string, error)
- func (x *File) GetCols(sheet string) ([][]string, error)
- func (x *File) GetRows(sheet string) ([][]string, error)
- func (x *File) GetSheetIndex(name string) (int, error)
- func (x *File) GetSheetList() ([]string, error)
- func (x *File) GetSheetName(index int) (string, error)
- func (x *File) GetWorkBookStructure() *xmltypes.WorkBookEntity
- func (x *File) InsertCols(sheet, col string, n int) error
- func (x *File) InsertRows(sheet string, row int) error
- func (x *File) MergeCell(_, _, _ string) error
- func (x *File) NewSheet(name string) (int, error)
- func (x *File) NewStreamWriter(sheet string) (*StreamWriter, error)
- func (x *File) NewStyle(_ *xmltypes.StyleConfig) (int, error)
- func (x *File) ProtectSheet(_ string, _ *xmltypes.SheetProtection) error
- func (x *File) RemoveCol(sheet, col string) error
- func (x *File) RemoveRow(sheet string, row int) error
- func (x *File) Rows(sheet string) (*Rows, error)
- func (x *File) Save(filename string) error
- func (x *File) SetCellFormula(sheet, axis, formula string) error
- func (x *File) SetCellStyle(_, _, _ string, _ int) error
- func (x *File) SetCellValue(sheet, axis string, value any) error
- func (x *File) SetDocProps(_ *xmltypes.DocProps) error
- func (x *File) SetSheetName(oldName, newName string) error
- func (x *File) UnmergeCell(_, _ string) error
- func (x *File) UnprotectSheet(_, _ string) error
- type Rows
- type StreamWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File holds the internal structure for XLS files.
func NewFile ¶
func NewFile() *File
NewFile creates a new XLS file structure with one default sheet.
func OpenReader ¶
OpenReader opens an existing XLS file from an io.Reader.
func (*File) AddPicture ¶
func (x *File) AddPicture(_, _, _ string, _ *xmltypes.GraphicOptions) error
AddPicture adds a picture to a worksheet (no-op for XLS write).
func (*File) AutoFilter ¶
AutoFilter sets auto filter for the range (no-op for XLS write).
func (*File) DeleteSheet ¶
DeleteSheet deletes the sheet with the given name.
func (*File) DuplicateSheet ¶
DuplicateSheet duplicates a sheet from one index to another.
func (*File) FreezePane ¶
FreezePane sets a freeze pane (no-op for XLS write).
func (*File) GetCellFormula ¶
GetCellFormula gets the formula of a cell (XLS does not support formula storage; returns empty).
func (*File) GetCellValue ¶
GetCellValue retrieves the value of a cell in an XLS file.
func (*File) GetSheetIndex ¶
GetSheetIndex returns the index of the sheet with the given name.
func (*File) GetSheetList ¶
GetSheetList returns the list of sheet names in the XLS file.
func (*File) GetSheetName ¶
GetSheetName returns the name of the sheet at the given index.
func (*File) GetWorkBookStructure ¶
func (x *File) GetWorkBookStructure() *xmltypes.WorkBookEntity
GetWorkBookStructure returns the exposed workbook structure for compatibility.
func (*File) InsertCols ¶
InsertCols inserts columns at the given 1-based position.
func (*File) InsertRows ¶
InsertRows inserts empty rows after the given 1-based position in a XLS file.
func (*File) NewStreamWriter ¶
func (x *File) NewStreamWriter(sheet string) (*StreamWriter, error)
NewStreamWriter returns a stream writer for a XLS worksheet.
func (*File) NewStyle ¶
func (x *File) NewStyle(_ *xmltypes.StyleConfig) (int, error)
NewStyle creates a new style (returns 0 for XLS).
func (*File) ProtectSheet ¶
func (x *File) ProtectSheet(_ string, _ *xmltypes.SheetProtection) error
ProtectSheet protects a worksheet (no-op for XLS write).
func (*File) SetCellFormula ¶
SetCellFormula sets the formula of a cell in an XLS file (stored as value string).
func (*File) SetCellStyle ¶
SetCellStyle sets the style for a cell (no-op for XLS).
func (*File) SetCellValue ¶
SetCellValue sets the value of a cell in an XLS file.
func (*File) SetDocProps ¶
SetDocProps sets the document properties for an XLS file (no-op for XLS).
func (*File) SetSheetName ¶
SetSheetName sets the name of a worksheet in an XLS file.
func (*File) UnmergeCell ¶
UnmergeCell un-merges a range (no-op for XLS).
func (*File) UnprotectSheet ¶
UnprotectSheet removes protection from a worksheet (no-op for XLS).
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows defines the stream reader for the rows in a XLS worksheet.
type StreamWriter ¶
type StreamWriter struct {
// contains filtered or unexported fields
}
StreamWriter defines the stream writer for the rows in a XLS worksheet.
func (*StreamWriter) Flush ¶
func (sw *StreamWriter) Flush() error
Flush finalizes any pending writes.