20
0

fix the bug of open office file, USER SHOULD UPDATE github.com/extrame/ole2 TOO

This commit is contained in:
Liu Ming 2016-08-12 14:50:42 +08:00
parent da346a5ffb
commit 76d16d4682

6
xls.go
View File

@ -23,6 +23,7 @@ func OpenReader(reader io.ReadSeeker, charset string) (wb *WorkBook, err error)
var dir []*ole2.File
if dir, err = ole.ListDir(); err == nil {
var book *ole2.File
var root *ole2.File
for _, file := range dir {
name := file.Name()
if name == "Workbook" {
@ -33,9 +34,12 @@ func OpenReader(reader io.ReadSeeker, charset string) (wb *WorkBook, err error)
book = file
// break
}
if name == "Root Entry" {
root = file
}
}
if book != nil {
wb = newWorkBookFromOle2(ole.OpenFile(book))
wb = newWorkBookFromOle2(ole.OpenFile(book, root))
return
}
}