Skip to content

The same excel, different results #1

Description

@3xxx

They like the same excel,but the different results.
my code:

package main

import (
    "fmt"
    "strconv"
    "github.com/tealeg/xlsx"
)
package main

import (
    "fmt"
    "strconv"
    "github.com/tealeg/xlsx"
)

type Catalog struct {
    Id          int64
    Name        string
    ParentId    int64
    Tnumber     string
    Drawn       string
    Designd     string
    Checked     string
    Emamined    string
    Verified    string
    Approved    string
    Data        string
    DesignStage string
    Section     string
    Projec      string
    Author      string
    Exist       bool
    TopicId     int64
}

func main() {
    test5()
}
func test5() {
    //  path := "D:/panic.xlsx"
    path := "D:/ok.xlsx"
    xlFile, _ := xlsx.OpenFile(path) //excelFileName

    var catalog Catalog
    for _, sheet := range xlFile.Sheets {
        for _, row := range sheet.Rows {
            j := 1
            catalog.Tnumber = row.Cells[j].String()
            catalog.Name = row.Cells[j+1].String()
            catalog.Drawn = row.Cells[j+2].String()
            catalog.Designd = row.Cells[j+3].String()
            catalog.Checked = row.Cells[j+4].String()
            catalog.Emamined = row.Cells[j+5].String()
            catalog.Verified = row.Cells[j+6].String()
            catalog.Approved = row.Cells[j+7].String()
            catalog.Data = row.Cells[j+8].String()
            catalog.DesignStage = row.Cells[j+9].String()
            catalog.Section = row.Cells[j+10].String()
            catalog.Projec = row.Cells[j+11].String()
            fmt.Printf("%s\n", catalog)
        }
    }
}

the panic file:panic.xlsx

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions