20
0

添加 sheet 是否隐藏接口

This commit is contained in:
chen.s.g 2020-05-18 14:37:43 +08:00
parent e9e7409707
commit 44e6d3affc
2 changed files with 15 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package xls
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"strings" "strings"
"unicode/utf16" "unicode/utf16"
@ -136,6 +137,7 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
var bs = new(boundsheet) var bs = new(boundsheet)
binary.Read(item, binary.LittleEndian, bs) binary.Read(item, binary.LittleEndian, bs)
// different for BIFF5 and BIFF8 // different for BIFF5 and BIFF8
fmt.Println("bs:", *bs)
wb.addSheet(bs, item) wb.addSheet(bs, item)
case XLS_Type_EXTERNSHEET: case XLS_Type_EXTERNSHEET:
if !wb.Is5ver { if !wb.Is5ver {

View File

@ -2,14 +2,15 @@ package xls
import ( import (
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"unicode/utf16" "unicode/utf16"
) )
type boundsheet struct { type boundsheet struct {
Filepos uint32 Filepos uint32
Type byte
Visible byte Visible byte
Type byte
Name byte Name byte
} }
@ -37,6 +38,7 @@ type WorkSheet struct {
parsed bool parsed bool
} }
// Row return row data by number
func (w *WorkSheet) Row(i int) *Row { func (w *WorkSheet) Row(i int) *Row {
row := w.rows[uint16(i)] row := w.rows[uint16(i)]
if row != nil { if row != nil {
@ -45,6 +47,16 @@ func (w *WorkSheet) Row(i int) *Row {
return row return row
} }
// GetSheetVisible provides a function to get worksheet visible
func (w *WorkSheet) GetSheetVisible() bool {
fmt.Println("ws visible:", w.bs.Visible)
if 0 == w.bs.Visible {
return true
}
return false
}
func (w *WorkSheet) parse(buf io.ReadSeeker) { func (w *WorkSheet) parse(buf io.ReadSeeker) {
w.rows = make(map[uint16]*Row) w.rows = make(map[uint16]*Row)
b := new(bof) b := new(bof)