Skip to content

Commit

Permalink
测试工作表可见性
Browse files Browse the repository at this point in the history
  • Loading branch information
chen.s.g committed May 18, 2020
1 parent 44e6d3a commit 2ac40b3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 0 additions & 2 deletions workbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package xls
import (
"bytes"
"encoding/binary"
"fmt"
"io"
"strings"
"unicode/utf16"
Expand Down Expand Up @@ -137,7 +136,6 @@ func (wb *WorkBook) parseBof(buf io.ReadSeeker, b *bof, pre *bof, offset_pre int
var bs = new(boundsheet)
binary.Read(item, binary.LittleEndian, bs)
// different for BIFF5 and BIFF8
fmt.Println("bs:", *bs)
wb.addSheet(bs, item)
case XLS_Type_EXTERNSHEET:
if !wb.Is5ver {
Expand Down
27 changes: 17 additions & 10 deletions worksheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package xls

import (
"encoding/binary"
"fmt"
"io"
"unicode/utf16"
)
Expand All @@ -28,14 +27,15 @@ type ExtSheetInfo struct {

//WorkSheet in one WorkBook
type WorkSheet struct {
bs *boundsheet
wb *WorkBook
Name string
rows map[uint16]*Row
//NOTICE: this is the max row number of the sheet, so it should be count -1
MaxRow uint16
id int
parsed bool
bs *boundsheet
wb *WorkBook
Name string
Selected bool
rows map[uint16]*Row
MaxRow uint16
id int
parsed bool
rightToLeft bool
}

// Row return row data by number
Expand All @@ -49,7 +49,6 @@ func (w *WorkSheet) Row(i int) *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
}
Expand Down Expand Up @@ -79,6 +78,14 @@ func (w *WorkSheet) parseBof(buf io.ReadSeeker, b *bof, pre *bof) *bof {
switch b.Id {
// case 0x0E5: //MERGEDCELLS
// ws.mergedCells(buf)
case XLS_Type_WINDOW2: // WINDOW2
var sheetOptions, firstVisibleRow, firstVisibleColumn uint16
binary.Read(buf, binary.LittleEndian, &sheetOptions)
binary.Read(buf, binary.LittleEndian, &firstVisibleRow) // not valuable
binary.Read(buf, binary.LittleEndian, &firstVisibleColumn) // not valuable
//buf.Seek(int64(b.Size)-2*3, 1)
w.rightToLeft = (sheetOptions & 0x40) != 0
w.Selected = (sheetOptions & 0x400) != 0
case 0x208: //ROW
r := new(rowInfo)
binary.Read(buf, binary.LittleEndian, r)
Expand Down

0 comments on commit 2ac40b3

Please sign in to comment.