Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example does not work #42

Closed
refflex opened this issue Apr 19, 2017 · 4 comments
Closed

Example does not work #42

refflex opened this issue Apr 19, 2017 · 4 comments

Comments

@refflex
Copy link

refflex commented Apr 19, 2017

Hi. Example does not work. Library created bad xlsx file (in attach).
xlsx := excelize.CreateFile()
xlsx.NewSheet(2, "Sheet2")
xlsx.SetCellValue("Sheet2", "A2", "Hello world.")
xlsx.SetCellValue("Sheet1", "B2", 100)
xlsx.SetActiveSheet(2)
err = xlsx.WriteTo("Workbook.xlsx")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
Workbook.xlsx

@tvc-dps
Copy link

tvc-dps commented Apr 19, 2017

It works for me, can you share full code?

@refflex
Copy link
Author

refflex commented Apr 19, 2017

It's full code. I copy/paste and build.

package main

import (
"fmt"
"os"

"github.com/Luxurioust/excelize"

)

func main() {
xlsx := excelize.CreateFile()
xlsx.NewSheet(2, "Sheet2")
xlsx.SetCellValue("Sheet2", "A2", "Hello world.")
xlsx.SetCellValue("Sheet1", "B2", 100)
xlsx.SetActiveSheet(2)
err := xlsx.WriteTo("Workbook.xlsx")
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}

@xuri
Copy link
Member

xuri commented Apr 20, 2017

@refflex Check the Go version you are using. This library needs Go version 1.8 or later after fixed issue #32 for collecting XML all attributes. Relate issue #35 & #39.

@refflex
Copy link
Author

refflex commented Apr 20, 2017

Many thanks! My version Go was 1.7.5. I updated to the latest 1.8.1 and all worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants