fix the bug of open office file, USER SHOULD UPDATE github.com/extrame/ole2 TOO
This commit is contained in:
parent
da346a5ffb
commit
76d16d4682
6
xls.go
6
xls.go
@ -23,6 +23,7 @@ func OpenReader(reader io.ReadSeeker, charset string) (wb *WorkBook, err error)
|
|||||||
var dir []*ole2.File
|
var dir []*ole2.File
|
||||||
if dir, err = ole.ListDir(); err == nil {
|
if dir, err = ole.ListDir(); err == nil {
|
||||||
var book *ole2.File
|
var book *ole2.File
|
||||||
|
var root *ole2.File
|
||||||
for _, file := range dir {
|
for _, file := range dir {
|
||||||
name := file.Name()
|
name := file.Name()
|
||||||
if name == "Workbook" {
|
if name == "Workbook" {
|
||||||
@ -33,9 +34,12 @@ func OpenReader(reader io.ReadSeeker, charset string) (wb *WorkBook, err error)
|
|||||||
book = file
|
book = file
|
||||||
// break
|
// break
|
||||||
}
|
}
|
||||||
|
if name == "Root Entry" {
|
||||||
|
root = file
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if book != nil {
|
if book != nil {
|
||||||
wb = newWorkBookFromOle2(ole.OpenFile(book))
|
wb = newWorkBookFromOle2(ole.OpenFile(book, root))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user