From 76d16d468292fe65522eb76a9139b67efe484095 Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Fri, 12 Aug 2016 14:50:42 +0800 Subject: [PATCH] fix the bug of open office file, USER SHOULD UPDATE github.com/extrame/ole2 TOO --- xls.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/xls.go b/xls.go index ebfcb2e..b425fc3 100644 --- a/xls.go +++ b/xls.go @@ -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 } }