MCPcopy
hub / github.com/qax-os/excelize / OpenFile

Function OpenFile

excelize.go:133–147  ·  view source on GitHub ↗

OpenFile take the name of a spreadsheet file and returns a populated spreadsheet file struct for it. For example, open spreadsheet with password protection: f, err := excelize.OpenFile("Book1.xlsx", excelize.Options{Password: "password"}) Close the file by Close function after opening the spreads

(filename string, opts ...Options)

Source from the content-addressed store, hash-verified

131//
132// Close the file by Close function after opening the spreadsheet.
133func OpenFile(filename string, opts ...Options) (*File, error) {
134 file, err := os.Open(filepath.Clean(filename))
135 if err != nil {
136 return nil, err
137 }
138 f, err := OpenReader(file, opts...)
139 if err != nil {
140 if closeErr := file.Close(); closeErr != nil {
141 return f, closeErr
142 }
143 return f, err
144 }
145 f.Path = filename
146 return f, file.Close()
147}
148
149// newFile is object builder
150func newFile() *File {

Callers 15

TestDeleteDrawingFunction · 0.85
TestAddChartFunction · 0.85
TestDeleteChartFunction · 0.85
TestEncryptFunction · 0.85
TestFormControlFunction · 0.85
TestAddHeaderFooterImageFunction · 0.85
TestAddPictureFunction · 0.85
TestAddPictureErrorsFunction · 0.85
TestGetPictureFunction · 0.85
TestDeletePictureFunction · 0.85
TestRowsFunction · 0.85

Calls 2

OpenReaderFunction · 0.85
CloseMethod · 0.65

Tested by 15

TestDeleteDrawingFunction · 0.68
TestAddChartFunction · 0.68
TestDeleteChartFunction · 0.68
TestEncryptFunction · 0.68
TestFormControlFunction · 0.68
TestAddHeaderFooterImageFunction · 0.68
TestAddPictureFunction · 0.68
TestAddPictureErrorsFunction · 0.68
TestGetPictureFunction · 0.68
TestDeletePictureFunction · 0.68
TestRowsFunction · 0.68