tealeg / xlsx

Go library for reading and writing XLSX files.
Other
5.81k stars 810 forks source link

Can not open excel files when added AutoFilter #727

Closed linzhicheng5512 closed 1 year ago

linzhicheng5512 commented 2 years ago

1.Version: v3.2.3 2.Test code:

import (
    "github.com/tealeg/xlsx/v3"
)

type structTest struct {
    IntVal     int    `xlsx:"0"`
    StringVal  string  `xlsx:"1"`
    FloatVal   float64 `xlsx:"2"`
    IgnoredVal int     `xlsx:"3"`
    BoolVal    bool    `xlsx:"4"`
}

func main() {
    structVal := &structTest{
        IntVal:     16,
        StringVal:  "hello world",
        FloatVal:   3.14159216,
        IgnoredVal: 7,
        BoolVal:    true,
    }

    //create a new xlsx file and write a struct
    file := xlsx.NewFile()
    sheet, _ := file.AddSheet("TestSheet")
    row := sheet.AddRow()
    row.SetHeight(12.5)
    row.WriteStruct(structVal, -1)
    sheet.AutoFilter = &xlsx.AutoFilter{TopLeftCell: "A1", BottomRightCell: "E1"}
    err := file.Save("test.xlsx")
    if err != nil {
        panic(err)
    }
}

3.Open 'test.xlsx' file, have this error message image 4.This issue is similar to the https://github.com/tealeg/xlsx/issues/679

github-actions[bot] commented 1 year ago

Stale issue message