20
0

测试工作表可见性

This commit is contained in:
chen.s.g 2020-05-18 15:13:59 +08:00
parent 44e6d3affc
commit 2ac40b33db
2 changed files with 17 additions and 12 deletions

View File

@ -3,7 +3,6 @@ package xls
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"strings" "strings"
"unicode/utf16" "unicode/utf16"
@ -137,7 +136,6 @@ 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,7 +2,6 @@ package xls
import ( import (
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"unicode/utf16" "unicode/utf16"
) )
@ -28,14 +27,15 @@ type ExtSheetInfo struct {
//WorkSheet in one WorkBook //WorkSheet in one WorkBook
type WorkSheet struct { type WorkSheet struct {
bs *boundsheet bs *boundsheet
wb *WorkBook wb *WorkBook
Name string Name string
rows map[uint16]*Row Selected bool
//NOTICE: this is the max row number of the sheet, so it should be count -1 rows map[uint16]*Row
MaxRow uint16 MaxRow uint16
id int id int
parsed bool parsed bool
rightToLeft bool
} }
// Row return row data by number // Row return row data by number
@ -49,7 +49,6 @@ func (w *WorkSheet) Row(i int) *Row {
// GetSheetVisible provides a function to get worksheet visible // GetSheetVisible provides a function to get worksheet visible
func (w *WorkSheet) GetSheetVisible() bool { func (w *WorkSheet) GetSheetVisible() bool {
fmt.Println("ws visible:", w.bs.Visible)
if 0 == w.bs.Visible { if 0 == w.bs.Visible {
return true return true
} }
@ -79,6 +78,14 @@ func (w *WorkSheet) parseBof(buf io.ReadSeeker, b *bof, pre *bof) *bof {
switch b.Id { switch b.Id {
// case 0x0E5: //MERGEDCELLS // case 0x0E5: //MERGEDCELLS
// ws.mergedCells(buf) // 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 case 0x208: //ROW
r := new(rowInfo) r := new(rowInfo)
binary.Read(buf, binary.LittleEndian, r) binary.Read(buf, binary.LittleEndian, r)